Browse Source

Changes for automatically starting dev server.

feature/python-error-tracking
Drew Larson 9 years ago
parent
commit
c8848cf7ce
  1. 6
      bikeshop_project/bikeshop/urls.py
  2. 2
      provision/group_vars/all
  3. 33
      provision/roles/nginx/templates/development/nginx-site.conf
  4. 10
      provision/roles/supervisor/development/supervisor-program.conf
  5. 5
      provision/site.yml
  6. 1
      requirements/development.txt
  7. 1
      requirements/production.txt

6
bikeshop_project/bikeshop/urls.py

@ -13,9 +13,12 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include 1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
""" """
from django.conf import settings
from django.conf.urls import include, url from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.views import login from django.contrib.auth.views import login
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from core import urls as core_urls from core import urls as core_urls
from registration import urls as member_urls from registration import urls as member_urls
@ -25,3 +28,6 @@ urlpatterns = [
url(r'^member/', include(member_urls)), url(r'^member/', include(member_urls)),
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
] ]
if getattr(settings, 'DEBUG'):
urlpatterns += staticfiles_urlpatterns()

2
provision/group_vars/all

@ -9,6 +9,8 @@ venv: /opt/venv/{{ app_name }}-{{ group_names[0] }}
db_name: "{{ app_name }}_development" db_name: "{{ app_name }}_development"
db_user: "{{ app_name }}" db_user: "{{ app_name }}"
app_port: 8475
db_user_password: "{{ secret_db_user_password }}" db_user_password: "{{ secret_db_user_password }}"
secret_db_user_password: password secret_db_user_password: password
app_domain_name: bikeshop.local

33
provision/roles/nginx/templates/development/nginx-site.conf

@ -0,0 +1,33 @@
server {
listen 80;
server_name www.{{ app_domain_name }};
# $scheme will get the http protocol
# and 301 is best practice for tablet, phone, desktop and seo
return 301 http://{{ app_domain_name }}$request_uri;
}
server {
listen 80;
server_name {{ app_domain_name }};
# location = /favicon.ico { access_log off; log_not_found off; }
# location /static/ {
# root {{ app_dir }};
# }
# location /media/ {
# root {{ app_dir }};
# }
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 10;
proxy_read_timeout 10;
proxy_pass http://localhost:{{ app_port }}/;
}
}

10
provision/roles/supervisor/development/supervisor-program.conf

@ -0,0 +1,10 @@
[group:{{ app_name }}]
programs=django
[program:django]
command={{ venv }}/bin/gunicorn -b 127.0.0.1:{{ app_port }} --reload {{ app_name }}.wsgi:application
directory={{ app_dir }}
environment=DJANGO_SETTINGS_MODULE="{{ settings_module }}"
autostart=true
autorestart=true
redirect_stderr=true
user=vagrant

5
provision/site.yml

@ -7,6 +7,8 @@
- zenoamaro.postgresql - zenoamaro.postgresql
- python - python
- database - database
- supervisor
- nginx
- app - app
- name: Deployment tasks - name: Deployment tasks
@ -14,5 +16,4 @@
remote_user: root remote_user: root
roles: roles:
- deploy-code - deploy-code
- supervisor
- nginx

1
requirements/development.txt

@ -2,3 +2,4 @@
-r testing.txt -r testing.txt
django-debug-toolbar django-debug-toolbar
PyYAML PyYAML
gunicorn==19.4.5

1
requirements/production.txt

@ -1,2 +1 @@
-r base.txt -r base.txt
gunicorn==19.4.5

Loading…
Cancel
Save