Pastebin¶
Share codes and notes with your friends!
- License
MIT
Basic Commands¶
Setting Up Your Users¶
To create an superuser account, use this command:
$ python manage.py createsuperuser
Test coverage¶
To run the tests, check your test coverage, and generate an HTML coverage report:
$ coverage run -m pytest
$ coverage html
$ open htmlcov/index.html
Running tests with py.test¶
$ pytest
Celery¶
This app comes with Celery.
To run a celery worker:
cd pastebin
celery -A config.celery_app worker -l info
Please note: For Celery’s import magic to work, it is important where the celery commands are run. If you are in the same folder with manage.py, you should be right.
Email Server¶
In development, it is often nice to be able to see emails that are being sent from your application. For that reason local SMTP server MailHog with a web interface is available as docker container.
Container mailhog will start automatically when you will run all docker containers. Please check cookiecutter-django Docker documentation for more details how to start all containers.
With MailHog running, to view messages that are sent by your application, open your browser and go to http://127.0.0.1:8025
Deployment¶
The following details how to deploy this application.
Docker¶
You will need to build the stack first. To do that, run:
docker-compose -f production.yml build
Once this is ready, you can run it with:
docker-compose -f production.yml up
To run the stack and detach the containers, run:
docker-compose -f production.yml up -d
To run a migration, open up a second terminal and run:
docker-compose -f production.yml run --rm django python manage.py migrate
To create a superuser, run:
docker-compose -f production.yml run --rm django python manage.py createsuperuser
If you need a shell, run:
docker-compose -f production.yml run --rm django python manage.py shell
To check the logs out, run:
docker-compose -f production.yml logs