The Application Portal for the Prime Ministers Science Prizes
A home for development of the Application Portal for the Prime Ministers Science Prizes
Settings
Moved to settings.
Deployment Environment
Create a Python virtual environment.
Istall all dependecies.
Run migrations.
Create a superuser.
Run server with the the certificate:
$ ./manage.py runserver_plus --cert-file cert.crt --key-file cert.key OR: $ ./manage.py runserver_plus 0.0.0.0:8080 --cert-file cert.crt --key-file cert.key
To make life easier, add import the crt file as a trusted server sertificate in your browser (read more at: https://support.google.com/chrome/a/answer/6342302).
Basic Commands
Setting Up Your Users
To create a normal user account, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.
To create an superuser account, use this command:
$ python manage.py createsuperuser
For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.
Type checks
Running type checks with mypy:
$ mypy portal
Test coverage
To run the tests, check your test coverage, and generate an HTML coverage report:
$ coverage run -m pytest $ coverage html $ open htmlcov/index.html
Running tests with py.test
$ pytest
Live reloading and Sass CSS compilation
Moved to Live reloading and SASS compilation.
PostgreSQL Upgrade
/usr/lib/postgresql/15/bin/initdb -D /var/lib/postgresql/15/main --locale=C.UTF-8 # recreate the cluster wiht C.UTF-8 locale /usr/lib/postgresql/15/bin/pg_upgrade --old-datadir=/var/lib/postgresql/14/main \ --new-datadir=/var/lib/postgresql/15/main --old-bindir=/usr/lib/postgresql/14/bin \ --new-bindir=/usr/lib/postgresql/15/bin --old-options '-c config_file=/etc/postgresql/14/main/postgresql.conf' \ --new-options '-c config_file=/etc/postgresql/15/main/postgresql.conf' # upgrade the whole cluster
Sentry
Sentry is an error logging aggregator service. You can sign up for a free account at https://sentry.io/signup/?code=cookiecutter or download and host it yourself. The system is setup with reasonable defaults, including 404 logging and integration with the WSGI application.
You must set the DSN url in production.
Deployment
The following details how to deploy this application.
Heroku
See detailed cookiecutter-django Heroku documentation.