Write about your project in this area.
Create and activate a virtualenv:
virtualenv venv
source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
NOTE: After installing dependencies, pip-tools is also installed. You can now use it to manage package dependencies of your project.
'''
Add a new package to requirements.in and run the following command to auto-update requirements.txt file
'''
pip-compile requirements.in
'''
Run the following command to sync your virtualenv
'''
pip-sync
For more details, https://github.com/nvie/pip-tools
Migrate, create a superuser, and run the server:
python manage.py migrate
python manage.py makemigrations hashertalk
python manage.py createsuperuser
python manage.py runserver
Edit the environment variables in '.env.template' file and then RENAME the file to '.env'
NOTE: This file has already been added to .gitignore, hence it will not be pushed to your repository. While deployment or using CI tools like travis or circle-ci, you have to take care of setting the environment variables seperately.
This project uses dj-database-url library to setup databases. Use the DATABASE_URL environment variable to configure your Django application. set this environment variable with the complete database url. For more info: https://github.com/kennethreitz/dj-database-url
This project uses dj-email-url library to setup email servers. Provide your smtp server url in the EMAIL_URL environment variable. For more info: https://github.com/migonzalvar/dj-email-url
There's a 'static' directory configured already inside the project that is to be used to keep satic JavaScript, CSS, etc files to be used in templates.
Some test cases have been included in the authentication/test directory. Use the following command to run test cases in all apps.
python manage.py test
If Travis is setup, then use the .travis.yml file in the project root directory to configure travis settings, setting up test environment for travis etc. For more info on travis, https://travis-ci.org/
If Circle-CI is setup, then it takes most of the settings from the project itself, but still there is a circle.yml file included at the project root for configuration. for more info, https://circleci.com/docs/language-python/
Deployment to heroku requires a Procfile which is present in the main directory. This can always be changed on need basis.
Following steps need to be undertaken to deploy to heroku
- Create an account on heroku if not already.
- Create a heroku app - you could either use the heroku dashboard to do this or the heroku cli.
- Install Heroku cli - documentation
- Use
heroku login
and enter your credentials. - Run
heroku create {app-name}
to create your app on heroku. This would give you the app deployment url and the apps git url. documentation.
- Add the heroku git url using
git remote add heroku {heroku-git-url}
(required only for the first time). - To deploy a build, run
git push heroku HEAD:master
. This should push all changes to heroku which can be viewed at the app url.