Giter Club home page Giter Club logo

python-first-api's Introduction

python_first_api

alt text

steps

  • init venv
  • pip install django djangorestframework django-cors-headers
  • django-admin startproject <name_project>
  • add new module in settings -> INSTALLED_APPS and configs of cors and djangorestframework
  • create models
  • python ./manage.py makemigrations
  • python ./manage.py migrate
  • register model in admin.py
  • python ./manage.py createsuperuser
  • python ./manage.py runserver
  • python ./manage.py startapp <name_module>
  • create serializers.py
  • create views and add views in urls.py
  • test in browser http://127.0.0.1:8000/api/users/?format=api

requirements

  • create requirements: pip freeze > requirements.txt
  • after create venv: pip install -r requirements.txt

the next time you run

  • pip install --force-reinstall -U setuptools
  • pip install -r requirements.txt

steps for connect sql server

plugins vscode

  • python
  • black formatter
  • docker

docker used

docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=12345Sa';" \ -p 1433:1433 --name sql1 --hostname sql1 \ -d \ mcr.microsoft.com/mssql/server:2022-latest

structure files ex

files

version pip

asgiref==3.8.1
certifi==2024.2.2
charset-normalizer==3.3.2
coreapi==2.3.3
coreschema==0.0.4
Django==5.0.6
django-cors-headers==4.3.1
djangorestframework==3.15.1
drf-yasg==1.21.7
idna==3.7
inflection==0.5.1
itypes==1.2.0
Jinja2==3.1.4
MarkupSafe==2.1.5
mssql-django==1.5
openapi-codec==1.3.2
packaging==24.0
pyodbc==5.1.0
pytz==2024.1
PyYAML==6.0.1
requests==2.32.2
setuptools==70.0.0
simplejson==3.19.2
sqlparse==0.5.0
typing_extensions==4.11.0
uritemplate==4.1.1
urllib3==2.2.1

links

python-first-api's People

Contributors

savio777 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.