Website written using django and python 3.5
Make sure you have python3
and pipenv
installed, and create the environment:
pipenv install
then start a new shell with the environment:
pipenv shell
You also need pdflatex in your path to be able to generate PDF's. "apt install texlive-full" works, but you can probably skip a lot of the packages and documentation and get by anyways.
- Open
alge/settings.py
and enable debugging. Static files won't be served otherwise.
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
- You need a user to access most parts of the site. Create a new superuser with:
python3 manage.py createsuperuser
- Start the webserver by running
python3 manage.py runserver
- Visit http://localhost:8000 and log in.
You can run a LiveReload server
during development, which when combined with a LiveReload extension
will refresh the current page when any file is changed. It is enabled by
default when DEBUG = True
. Just start the server in another terminal:
python3 manage.py livereload
To keep the code formatting consistent, run this command to auto-format all changed Python files in-place before committing them.
git diff --name-only | grep '.py' | xargs yapf -i
Place your tests next to the code they're testing. Run all tests with:
python3 ./manage.py test --pattern="*_test.py"
You will get a error complaining about a cyclic dependency when runnig the first migration. To fix this, comment out the reference to "strecklista.Group" in the EmailUser.models.MyUser class, run the migration, remove the comment and migrate again
As this project uses gmail for outgoing mail you need to enable "less secure devices" on the google account as described here. This should only be needed the first time the website is set up on a new server.
When new users are registererd via the /register page they are automatically placed in the group with the lowest sorting weight.