Medicine Patent Pool - Reporting System - Backend
- Clone the repository and cd into it
- Install all required packages using:
pip install -r requirements.txt
- Install postressql using link: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
- Start pgadmin and create a new database
- Configure the database name, etc. in MPP_API\settings.py file inside the DATABASES dictionary in NAME field, etc.
- Place your environment variables file in MPP_API folder and specify it's name in load_dotenv inside settings.py file. eg: load_dotenv('MPP_API/.env.dev')
- Delete all files except init.py from api\migrations folder (if any present)
- Run commands:
python manage.py makemigrations api
orpython manage.py makemigrations
python manage.py migrate
- Create superuser/admin account and keep Role=ADMIN when prompted -> run
python manage.py createsuperuser
- Go to api/namespaces/clock.py, comment out permission_classes. Call the api/clock/ endpoint to add a quarter in the system (entire step yet to be automated). Go back and uncomment the line you just commented. You can change the quarter name to be added by going in the api\namespaces\clock.py file and changing the quarter_name in the Quarter.objects.create() command
- Import Product List from csv file using command:
python manage.py runscript import_product_list --script-args <path_to_csv>
- Import Country List from csv file using command:
python manage.py runscript import_countries --script-args <path_to_csv>
- (Optional Step) Import Sales Report, if any, from csv using command
python manage.py runscript import_sales_report --script-args <path_to_csv> <type_of_sales_report = API or FDF>
- Restore db dumps in db/db_dump folder using
pg_restore -h <host rds dns> -p 5432 --no-owner --no-privileges --role=postgres -U postgres -d <db_name> <path_to_dump>
- Run local server using:
python manage.py runserver