# List of PEP8 Errors and Warnings to Ignore
# E501 line too long (82 > 79 characters)
# W191 indentation contains tabs
# W293 blank line contains whitespace
# E302 expected 2 blank lines, found 0
# Most of the Indentation continuation rules are ignored (except mixed spaces and tabs)
# E121 continuation line indentation is not a multiple of four
# E122 continuation line missing indentation or outdented
# E123 closing bracket does not match indentation of opening bracket’s line
# E124 closing bracket does not match visual indentation
# E125 continuation line does not distinguish itself from next logical line
# E126 continuation line over-indented for hanging indent
# E127 continuation line over-indented for visual indent
# E128 continuation line under-indented for visual indent
# Whitespace
# E261 at least two spaces before inline comment
[pep8]
ignore = E501,W191,W293,E302,E12,E261
exclude = migrations
[flake8]
# F403 unable to detect undefined names (from whatever import *)
ignore = E501,W191,W293,E302,E12,E261,F403
exclude = migrations,*-steps.py
"settings":
{
"SublimeLinter":
{
"pep8_ignore":
[
"E501",
"W191",
"W293",
"E302",
"E12",
"E261"
]
}
}
Think of CI as your tripwire for potential problems
Execute Shell
#!/bin/bash
cd ~/$WORKSPACE
virtualenv ~/envs/${JOB_NAME}
source ~/envs/${JOB_NAME}/bin/activate
pip install -r requirements.txt
pip install -r testing_requirements.txt
python setup.py develop
# run tests using django-nose
./manage.py test
pep8 [your_package] > pep8.report
Publish Cobertura Coverage Report (setup.cfg)
[nosetests]
with-doctest=1
with-xcoverage=1
cover-erase=
cover-package=[your_package]
with-xunit=1
#!/bin/bash
cd ~/$WORKSPACE
virtualenv ~/envs/${JOB_NAME}
source ~/envs/${JOB_NAME}/bin/activate
pip install -r requirements.txt
pip install -r testing_requirements.txt
python setup.py develop
nosetests functional/*.py
#!/bin/bash
cd ~/$WORKSPACE
virtualenv ~/envs/${JOB_NAME}
source ~/envs/${JOB_NAME}/bin/activate
pip install -r requirements.txt
pip install -r testing_requirements.txt
pip install -r lettuce_requirements.txt
python setup.py develop
./manage.py harvest --verbosity=3 --with-xunit
> virtualenv $ENVS/sentry && source $ENVS/sentry/bin/activate
> pip install -U sentry mysql-python # (or psychopg, etc...)
/etc/sentry.conf.py
DATABASES = {...}
# Set this to false to require authentication
SENTRY_PUBLIC = True
SENTRY_WEB_HOST = '0.0.0.0'
SENTRY_WEB_PORT = 9000
SENTRY_WEB_OPTIONS = {
'workers': 3, # the number of gunicorn workers
# 'worker_class': 'gevent',
}
# Mail server configuration
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# TODO: Configure your SMTP Credentials
EMAIL_SUBJECT_PREFIX = '[Sentry] '
SERVER_EMAIL = 'sentry@example.com'
[program:sentry]
directory=/tmp
command=$ENVS/sentry/bin/sentry --config=/etc/sentry.conf.py start http
server {
listen 80;
listen 443 ssl;
server_name sentry.example.com;
location / {
proxy_pass http://localhost:9000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install percona-server-server nginx openssh-server supervisor redis-server ntp
sudo apt-get -y install build-essential git linux-headers-generic htop tmux pv
sudo apt-get -y install python-virtualenv
sudo apt-get -y install libmysqlclient-dev libxml2-dev libxslt-dev python-dev libjpeg-dev zlib1g-dev
sudo apt-get -y install nodejs
base:
'*': - core - ssh - ssh.deploy
'roles:web': - match: grain - ssl.certs - nginx - app.web
'roles:app': - match: grain - supervisor - redis - node - app.app
'roles:db': - match: grain - mysql.server - mysql.backup - mysql.utils - app.db
location @uwsgi {
uwsgi_pass 127.0.0.1:3031;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme; # scheme for redirects under SSL
}
[program:uwsgi]
command=$VIRTUAL_ENV/bin/uwsgi --socket 0.0.0.0:3031 --processes 5 --master --home $VIRTUAL_ENV --vacuum --harakiri 200 --wsgi "<your_project>.wsgi" --buffer-size 16384
directory=$PROJECT_HOME
user=ubuntu
numprocs=1
stdout_logfile=/var/log/uwsgi.log
stderr_logfile=/var/log/uwsgi.log
autostart=true
autorestart=true
startsecs=1
stopwaitsecs=10
stopsignal=INT
geo $maintenance { # Change default to 1 to enable maintenance (and 0 to disable) default 0; 127.0.0.0/8 0; # Local Allowed 192.168.0.0/16 0; # Private Addressing Allowed; 10.0.0.0/7 0; # Amazon Local Allowed 12.34.56.78/32 0; # Your Office IP }
location / { if ($maintenance) { return 503; } ... }
location / {
...
try_files /maintenance.active.html @uwsgi
}
@task
def enter_maintenance():
with cd(CODE_DIR):
run('ln -sf maintenance.html maintenance.active.html')
@task
def exit_maintenance():
with cd(CODE_DIR):
with settings(warn_only=True):
run('unlink maintenance.active.html')
@task def production(branch='master'): env.hosts = ['example.com'] env.branch = branch
@task def sandbox(branch='master'): env.hosts = ['sandbox.example.com'] env.branch = branch
@task def dev(branch='develop'): env.hosts = ['dev.example.com'] env.branch = branch
@task def beta(branch='develop'): env.hosts = ['beta.example.com'] env.branch = branch if not confirm("Do NOT run this with any migrations pending, continue?", default=False): abort("Aborting...")
> fab production deploy
> fab dev:branch=new-feature-branch deploy
> fab beta:new-admin-feature deploy