- Use it on a Linux or MacOS. If you are using Windows, use WSL.
- Have
make
installed. On Debian/Ubuntu, it can be withsudo apt install make
- Make sure you have Python v3.8 or higher installed.
- Make sure you have a PostgreSQL database up and running.
-
Make a copy of
.env.sample
file and save it as.env
.cp .env.sample .env
-
Find and fill these values in
.env
... SECRET_KEY= ... DB_USERNAME= DB_PASSWORD= DB_HOST= DB_PORT= DB_NAME=
-
Run these commands
make venv make migratedb make autopush
If you get errors at
make migratedb
then your database values are incorrect.If
make autopush
fails, open an issue in this repository. This command scrap data from UFV website and add it to the database. -
Start the server
make run
You should be running at http://localhost:8000
Django has in-built Admin portal that you can browse at http://localhost:8000/admin/
To create an account, use:
make su
You can use crontab to accomplish this.
crontab -e
At the bottom of that file, add something like this
0 2 * * * /bin/bash /absolute/path/to/backend/folder/.venv/bin/python manage.py auto_push
Now you have automated this job to run every night at 2am.
Use this to learn more about crontab https://www.geeksforgeeks.org/crontab-in-linux-with-examples/
This is not recommended, but if you have to then go to .env
and fill in DB_PUSH_PASSWORD=
with hex digest of SHA256 password. Use the Python commandline to generate it with hashlib library.
Then you can make a request to this endpoint
POST http://localhost:8000/api/push/
{
"password": "your-password"
}
This will take few minutes while data is fetched and saved to database. You may cancel/close this request but Django will continue to work on it in background. There is not way to stop it unless you shut the server down.