-
Copy to
env.example
into.env
cp env.example .env
-
Edit values in
.env
nano .env
-
Config domain
echo "127.0.1.1 dev.labcomp.com" | sudo tee -a /etc/hosts > /dev/null
-
Start container DB
docker-compose up -d mysql
-
Apply migrations
docker-compose run --rm django python manage.py migrate
-
Run Django Project
docker-compose up -d
-
Open project on browser
http://dev.labcomp.com:8000
-
Create superuser (Execute command and follow the steps)
docker-compose run --rm django python manage.py createsuperuser
-
Access to django admin
http://dev.labcomp.com:8000/admin/
-
Exit instantly on first error or failed test
docker-compose run --rm -e TEST=true django py.test -x accounts/tests.py
-
Activate the Python Debugger
docker-compose run --rm -e TEST=true django py.test --pdb accounts/tests.py
-
Run all the tests
docker-compose run --rm -e TEST=true django py.test
-
Run tests isort
docker-compose run --rm django isort -c -rc -df
-
Run tests flake8
docker-compose run --rm django flake8
-
Execute this command to runs over the entire source tree of the current directory and pulls out all strings marked for translation.
docker-compose run --rm django python manage.py makemessages --no-location -l es
-
Edit file public/locale/es/LC_MESSAGES/django.po and add a translation.
msgid "Hello world" msgstr "Hola mundo"
-
Compiles .po files to .mo files for use with builtin gettext support.
docker-compose run --rm django python manage.py compilemessages
-
Build
docker-compose -f docker-compose-production.yml build
-
Initialize
docker-compose -f docker-compose-production.yml up -d mysql docker-compose -f docker-compose-production.yml run --rm django python manage.py migrate --noinput docker-compose -f docker-compose-production.yml run --rm django python manage.py collectstatic --noinput docker-compose -f docker-compose-production.yml run --rm django python manage.py compilemessages
-
Run Django server
docker-compose -f docker-compose-production.yml up -d
-
Visit API api.labcomp.edwarbaron.me/
-
On Linux
pip install fabric ~/.local/bin/fab deploy_dev
-
On macOS
pip install --user fabric ~/Library/Python/2.7/bin/fab deploy_dev
-
Other taks
- fab deploy_dev
- fab deploy_production
- fab test
- fab update_local_db