This is a small Django application for demostrative purposes.
System requirements:
- Python3
- PostgreSQL
- Using of virtualenvwrapper is highly recommended.
The following Python modules are used:
- Django (3.0.7)
- psycopg2 (2.8.5): PostgreSQL connector.
- django-crispy-forms (1.9.1): To manage formsets.
- django-cookie-law (2.0.3): Cookie alert.
- pytest-django (3.9.0): Testing framework.
- pytest-cov (2.10.0): Coverage stats.
-
Using virtualenvwrapper:
$ cd ~/git $ git clone https://github.com/eduardofilo/test_app $ cd ~/git/test_app $ mkvirtualenv test_app -p python3 $ workon test_app (test_app) $ setvirtualenvproject $VIRTUAL_ENV . (test_app) $ pip install -r requirements.txt
-
Database setup:
$ sudo -u postgres psql postgres=# CREATE DATABASE testapp; postgres=# CREATE USER testuser WITH ENCRYPTED PASSWORD 'testpwd'; postgres=# ALTER USER testuser CREATEDB; postgres=# ALTER ROLE testuser SET client_encoding TO 'utf8'; postgres=# ALTER ROLE testuser SET default_transaction_isolation TO 'read committed'; postgres=# ALTER ROLE testuser SET timezone TO 'UTC'; postgres=# GRANT ALL PRIVILEGES ON DATABASE testapp TO testuser; postgres=# \q
-
Apply migrations:
$ cd ~/git/test_app $ workon . (test_app) $ python manage.py migrate
-
Load mock data (six minutes in my machine):
(test_app) $ python manage.py shell < fill_db.py
or
(test_app) $ python manage.py loaddata mock_data.json
-
Run development server:
(test_app) $ python manage.py runserver 0.0.0.0:8000
-
Open http://localhost:8000 in browser.