A web application made using Python 3, Django 2, and PostgreSQL.
Application allows to import users from csv file and change their balance.
- importing users from csv file using management command
- displaying all users
- making changes to users balance
- Python 3.7
- Django 2.2
- PostgreSQL
To run this project locally:
-
In docker-compose.yaml replace
temporary_secret_key
with your own secret key (https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/#secret-key) -
Build containers and run collectstatic
docker-compose build
docker-compose run app sh -c 'python manage.py collectstatic'
- Import users from csv file
docker-compose run app sh -c 'python manage.py import_users_data temp/users.csv'
- Start containers
docker-compose up
-
Application will be available at
http://0.0.0.0:8000/
-
To run tests
docker-compose run app sh -c 'python manage.py test'
To deploy application to Heroku:
- Sign up to Heroku account and install Heroku CLI https://devcenter.heroku.com/articles/heroku-cli
- In Heroku dashboard create new application
- In CLI connect to remote of your application
heroku git:remote -a <your-application-name>
- Log in to Container Registry
heroku container:login
- Build a local image with correct tag
docker build -t registry.heroku.com/<your-application-name>/web .
- Push your secret key
heroku config:set SECRET_KEY=SOME_SECRET_VALUE -a <your-application-name>
- Create and connect PostgreSQL
heroku addons:create heroku-postgresql:hobby-dev -a <your-application-name>
- Push local image to Heroku registry
docker push registry.heroku.com/<your-application-name>/web
- Release changes
heroku container:release -a <your-application-name> web
- Run
manage.py migrate
on Heroku
heroku run python manage.py migrate