nad2000 / RSTA-apportal-hub

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Application Portal for the Prime Ministers Science Prizes

A home for development of the Application Portal for the Prime Ministers Science Prizes

Built with Cookiecutter Django Black code style GitHub issues GitHub forks GitHub stars Django CI

Settings

Moved to settings.

Deployment Environment

  1. Create a Python virtual environment.

  2. Istall all dependecies.

  3. Run migrations.

  4. Create a superuser.

  5. 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
    
  6. 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.

About


Languages

Language:Python 40.9%Language:CSS 27.8%Language:SCSS 12.3%Language:HTML 12.1%Language:Less 2.9%Language:Jinja 2.8%Language:JavaScript 0.9%Language:Shell 0.2%Language:Procfile 0.0%