Price predictor using django
- install python3
- install postgresql(optional)
- install Django framework using pip3
pip3 install Django
- install coverage library using pip3
pip3 install coverage
to generate coverage report of unit test - run
pip3 install psycopg2
for postgres database connection (if you are using postgresql) - run
pip3 install django-nose
for unit testing with coverage report - run
pip3 install django-mathfilters
for front end maths operations - start a project using
django-admin startproject fuelpricepredictor
- go to project directory using
cd fuelpricepredictor
- start the sub project using
python3 manage.py startapp mainapp
- create a role using
creare role rol_name with encrypted password pass_word;
for egcreare role django with encrypted password ******;
- create database database_name in your db server using
create database database_name;
for egcreate database pricepredicor;
- grant all accees on newly created db for newly created role using
grant all on database database_name to rol_name;
for eggrant all on database pricepredicor to django;
- give login access to the newly created role using
alter role role_name with login;
for egalter role django with login;
- locate settings.py in fuelpricepredictor/fuelpricepredictor folder
- go to line 94
- put your dbname, role and password
After creating any database model, migrate the model using following commands.
- connect to the postgres database server
- create a database 'pricepredictor' using
create database pricepredictor; commit;
or simply create from the GUI tool python3 manage.py makemigrations
to generate migration script filespython3 manage.py migrate
to migrate the migration scriptspython3 manage.py sqlmigrate mainapp 0001_initial
to migrate specific migration files
- run the scripts of ./scipts folder
- uncomment the code ./mainapp/forms.py from line 26-29
- Run server using
python3 manage.py runserver
- Run
python3 manage.py createsuperuser
to create Django superuser
- Run
python3 manage.py test mainapp/tests.py
to run unit tests - Run
coverage run manage.py test mainapp/tests.py
to run uni tests and generate coverage reports