- Download repo,
- Initialize virtual environment in it:
python -m venv env
, - Run that venv:
LLINUX or MACsource env/bin/activate
,
WINDOWS google say\env\Scripts\activate.bat
if it doesnt work do itcd env
cd Scripts
activate
cd ..
cd ..
- Install dependencies:
pip install -r requirements.txt
, - Create a new file such as
.env.example
inadvent_calendar
and chance his name to.env
- Create a new secret key:
python generateSecretKey.py
- Copy it and paste it into
advent_calendar / .env
up to SECRET_KEY
e.g.SECRET_KEY=n-9#+mf&sziujs^g1!+liv5gn@%0*)7dp)gtm^16eqyl+bvjlr
- (optional) Change database settings in settings.py if you want to use different (non-sqlite) db backend,
- Make migrations:
python manage.py makemigrations
, - Migrate database:
python manage.py migrate
, - Create admin:
python manage.py createsuperuser
, - To run dev server:
python manage.py runserver
- Download repo
- Run docker-compose up in it
- Ready. Thing is accessible at localhost:8000. Stopping and starting containers again results in making whole new migrations and reseting database (sqlite) content.
If you installed new pip dependency you need to allow others to know about it. To do so it is best to save all requirements
in one file, which in this case in named requirements.txt
. You can do this by typing following command:
pip freeze > requirements.txt
- install Nginx, download app
- nginx configuration, remember to change server_name:
server {
listen 80;
server_name HOSTNAME_HERE;
location / {
include proxy_params;
proxy_pass http://localhost:8000;
}
}
- ln -s do enabled,
- wszystko dalej jak w how to install,
- allowed hosts - add host
- if table doesnt exist:
python manage.py makemigrations; python manage.py migrate
- create admin:
python manage.py createsuperuser
and follow instructions
-/api/tasks/all/ __get all tasks
-/api/tasks/all/id/
__get one task by id
-/api/tasks/now/ __get all tasks with taskDate <= today
-/api/tasks/now/id/
__get one tasks by id (only with taskDate <= today)
-/api/tasks/answer __post userAnswer and check if it is correct (return true or false)
-/api/today/ __get today's date
-/admin/ __admin panel
Api is sort by taskDay.