The goal is the get csv file via web page, parse it and get provide a page for graphics.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Things you need to have installed:
- pipenv
- Docker
or
- pipenv
- Python3
- PostgreSQL
This is a quick project setup for local machine and development purpose to get server up at http://0.0.0.0:8000/
.
-
Clone this repo.
$ git clone git@github.com:diogosimao/b2blue-test.git b2blue-test
-
Create a virtual environment. Make sure you have pipenv installed.
$ cd b2blue-test $ pipenv --three && pipenv shell
It will need some extras. See requirements_docker.txt
$ pip install -r requirements_docker.txt
$ . ./bin/start-docker-development-server.sh
-
Create database on PostgreSQL
$ createdb b2blue-test
-
With a shortcut just edit
./bin/start-development-server.sh
with your DB system info and run the shell script. -
Or without the
script
follow ahead with:$ pip install -r requirements.txt
-
Set
DATABASE_URL
environment variable:$ export DATABASE_URL=pgsql://YOUR_USER:YOUR_PWD@127.0.0.1:5432/b2blue-test
-
Run Django
makemigration
andmigrate
:$ python manage.py makemigrations $ python manage.py migrate
-
Run the development server
$ python manage.py runserver
-
-
Necessary command:
$ python manage.py process_tasks
- It must be executed on second instance of a unix shell (with the same previously created environment
pipenv
and with requiredenviroment variables
)
- It must be executed on second instance of a unix shell (with the same previously created environment
-
Or in the same docker container running development server.
-
Sample:
$ docker exec -it <DJANGO_CONTAINER_ID> /bin/bash $ python manage.py process_tasks
-
-
Shell
-
Create
superuser
with the following line:$ python manage.py createsuperuser
-
-
Docker
-
In the same docker container running development server.
-
Sample:
$ docker exec -it <DJANGO_CONTAINER_ID> /bin/bash $ python manage.py createsuperuser
-
-
Default Django administration screen should be up at http://0.0.0.0:8000/admin
and you are able to login in.
From b2blue-test
directory with pipenv --three
and pipenv shell
previously executed:
$ pip install -r requirements.txt
To run the unittests for this system locally:
$ python manage.py test
In case you want to see code coverage the htmlcov
folder (which contains html output from coverage
package) will be created after running:
$ . ./bin/run-tests.sh
Do you have geckodrive
install for Firefox
? If not see jq.
After than install it with:
$ . ./bin/geckodrive-install.sh
and
$ python tests/functional/tests.py
- Django 2.0 - The web framework used
- Bootstrap4 - An open source toolkit for developing with HTML, CSS, and JS.
- font-awesome
- Via django-icons
- and <3
- Diogo Simão
- B2Blue.com