eduardofilo / test_app

This is a small Django application for demostrative purposes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

testapp

This is a small Django application for demostrative purposes.

Requirements

System requirements:

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.

Install/deploy

  1. 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
    
  2. 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
    
  3. Apply migrations:

    $ cd ~/git/test_app
    $ workon .
    (test_app) $ python manage.py migrate
    
  4. 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
    
  5. Run development server:

    (test_app) $ python manage.py runserver 0.0.0.0:8000
    
  6. Open http://localhost:8000 in browser.

About

This is a small Django application for demostrative purposes.


Languages

Language:JavaScript 89.9%Language:Python 6.3%Language:HTML 3.7%Language:CSS 0.0%