Skip to content

0xStryK3R/Sample-Django-Postgres-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample Django Project Using Postgres DB | Visitor Count

  1. Setup the DB Database:

    CREATE DATABASE carsdb;
    CREATE USER carsadmin WITH ENCRYPTED PASSWORD 'carspass';
    GRANT ALL PRIVILEGES ON DATABASE carsdb TO carsadmin;
  2. Clone Git-Repo into Local Directory.

  3. Update DB credentials in settings.py file in .\myproject\ folder to as per your own configuration.

  4. Open Command Line in main directory of project.

  5. Run below command inside project directory to setup environment

    python -m venv venv
  6. Activate enviroment with below command (for Windows):

    venv\Scripts\activate
  7. Run below command next to install required modules plus dependencies defined in requirements.txt

    pip install -r requirements.txt
  8. Migrate default/admin tables:

    python manage.py makemigrations
    python manage.py migrate
  9. Create a super user(admin) for your project:

    python manage.py createsuperuser

    Note: This user is used to manage administration for your project via the admins console: /admin.

  10. Migrate cars tables - cars_car and cars_driver tables:

    python manage.py makemigrations cars
    python manage.py migrate cars
  11. Insert some data into the newly created cars_car and cars_driver tables.

    Note: You can use sample insert queries provided in below files:
    cars_car.txt
    cars_driver.txt

  12. Run the project:

    python manage.py runserver 0.0.0.0:5000
  13. All Done!! Click Here to interact with your app:

Assumptions: Python and Postgres has been setup and running prior to starting with this project.

References: For Complete details, please refer How to use PostgreSQL with Django - the source article for this Repo.

Releases

No releases published

Packages

No packages published