Git Product home page Git Product logo

drf_pg's Introduction

DRF_PG

Django REST Framework, Postgres

  1. Create a new virtual environment python -m venv envName

  2. Create new django project django-admin startproject projectName . use "." to create project in current dir.

  3. Create a decent folder structure --Project -- ProjectName -- settings -- base.py -- dev.py -- urls.py -- asgi.py -- wsgi.py -- Apps -- AppName1 -- models.py -- serializers.py -- views.py -- urls.py -- AppName2 -- models.py -- serializers.py -- views.py -- urls.py -- utils.py -- manage.py -- requirement.txt -- .gitignore -- .dockerignore -- Dockerfile -- Jenkinsfile -- .env

  4. Start project python manage.py runserver

  5. Create Applications in app folder cd apps python manage.py startapp AppName3

  6. add new app to the INSTALLED_APPS list in the project settings.py file INSTALLED_APPS = [ #... apps.AppName3 ]

  7. Inside AppName3 folder create 2 new files as serializers.py and url.py The serializers.py file is used to define serializers for your Django models. Serializers allow to convert Django models into JSON or other content types. They are use to validate the data. The urls.py file is used to define the URL patterns for your Django app. It specifies how URLs should be mapped to views or other URL patterns within the app.

8 Connect PostgresSQL to Project DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'databaseName', 'USER': 'databaseUser', 'PASSWORD': 'databasePassword', 'HOST': 'localhost', 'PORT': '5432', } }

drf_pg's People

Contributors

adihargane 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.