This project is a single page application that allows users to see the current temperature at a certain address.
This application architecture is separated in two parts: frontend and backend.
Create a virtualenv - virtualenv is a tool to create isolated Python environments - We recommend using pyenv to management python versions and virtualenvs.
Create a virtualenv using Python 3.6.
pyenv install 3.6.0
pyenv virtualenv 3.6.0 venv-tramsdaol-3.6.0
pyenv activate venv-tramsdaol-3.6.0
After the virtualend was created install all dependencies cd server && pip install -r requiriments.txt
Ready, run the project python manage.py runserver
.
You need to install nodejs and Typescript.
We chose Angular 2 to write this application, so you need to install Angular CLI to management angular apps.
Just it, now run the command ng serve
.
First steps after PostgresSQL installation you need to create a user, type the following command createuser -P -s <user>
, in sequence create a database createdb <db>
.
Do not forget to set the environment variable DATABASE_URL
.
export DATABASE_URL=postgres://tramsdaol:123456@localhost:5432/tramsdaol
Running Postgres in Mac postgres -D /usr/local/var/postgres
.
This application was developed with the best practices of software development. So don't forget, Write tests for everything 🕵 .
Run backend tests: python manage.py test
.
Run frontend tests: ng test
.
NO TEST NO BEER
This application is separated into two parts: client
and server
. So you need to set up two repository in Heroku.
git remote add heroku-client https://git.heroku.com/quiet-badlands-78231.git
git remote add heroku-server https://git.heroku.com/guarded-coast-40901.git
You need to build the frontend files. Run the following command:
cd client/
ng build --prod
After build the folder dist
was created. This folder contais the minified/concatenated files.
Affter each push you need to rename the correct Procfile
, see Procfile.server
and Procfile.client
.
git push heroku-client master
git push heroku-server master
Server running in: https://guarded-coast-40901.herokuapp.com/ Client running in: https://quiet-badlands-78231.herokuapp.com/
Django Admin user/password
: loadsmart/1234qwer
.
--worker-class=meinheld.gmeinheld.MeinheldWorker
I've read a few articles to develop this project and improve my code.