-
Setup the DB Database:
CREATE DATABASE carsdb; CREATE USER carsadmin WITH ENCRYPTED PASSWORD 'carspass'; GRANT ALL PRIVILEGES ON DATABASE carsdb TO carsadmin;
-
Clone Git-Repo into Local Directory.
-
Update DB credentials in
settings.py
file in.\myproject\
folder to as per your own configuration. -
Open Command Line in main directory of project.
-
Run below command inside project directory to setup environment
python -m venv venv
-
Activate enviroment with below command (for Windows):
venv\Scripts\activate
-
Run below command next to install required modules plus dependencies defined in
requirements.txt
pip install -r requirements.txt
-
Migrate default/admin tables:
python manage.py makemigrations python manage.py migrate
-
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
. -
Migrate cars tables -
cars_car
andcars_driver
tables:python manage.py makemigrations cars python manage.py migrate cars
-
Insert some data into the newly created
cars_car
andcars_driver
tables.Note: You can use sample insert queries provided in below files:
cars_car.txt
cars_driver.txt -
Run the project:
python manage.py runserver 0.0.0.0:5000
-
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.