Mudanças entre as edições de "Mabanga"
De MochilaWiki
Ir para navegaçãoIr para pesquisarLinha 42: | Linha 42: | ||
Allow from all | Allow from all | ||
</Directory> | </Directory> | ||
+ | </source> | ||
+ | |||
+ | == com nginx == | ||
+ | <source lang="nginx"> | ||
+ | server { | ||
+ | server_name semente.com; | ||
+ | |||
+ | access_log off; | ||
+ | |||
+ | location /static/ { | ||
+ | alias /opt/myenv/proj/timeline/static/; | ||
+ | try_files $uri =404; | ||
+ | } | ||
+ | |||
+ | location / { | ||
+ | try_files $uri @django; | ||
+ | } | ||
+ | |||
+ | location @django { | ||
+ | proxy_pass http://semente.com:8001; | ||
+ | include proxy_params; | ||
+ | add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"'; | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | <source lang="bash"> | ||
+ | /opt/myenv/bin/gunicorn -c /opt/myenv/gunicorn_config.py socialproject.wsgi | ||
</source> | </source> |
Edição atual tal como às 14h33min de 5 de abril de 2015
Ostras em Kimbundu
apt-get install libapache2-mod-wsgi
Django com Apache
em /opt/myenv/proj/socialproject/wsgi.py
import sys
import site
import os
envpath = '/opt/myenv/lib/python2.7/site-packages'
pwd = os.path.dirname(os.path.abspath(__file__))
os.chdir(pwd)
sys.path.append('/opt/myenv/proj/socialproject')
sys.path.append('/opt/myenv/proj/')
site.addsitedir(envpath)
from django.core.wsgi import get_wsgi_application
os.environ['DJANGO_SETTINGS_MODULE'] = 'socialproject.settings'
application = get_wsgi_application()
em /etc/apache2/sites-enabled/projsocial
WSGIScriptAlias /projsocial /opt/myenv/proj/socialproject/wsgi.py
<Directory /var/www/projsocial/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static/ /opt/myenv/proj/timeline/static/
<Directory /opt/myenv/proj/timeline/static>
Order deny,allow
Allow from all
</Directory>
com nginx
server {
server_name semente.com;
access_log off;
location /static/ {
alias /opt/myenv/proj/timeline/static/;
try_files $uri =404;
}
location / {
try_files $uri @django;
}
location @django {
proxy_pass http://semente.com:8001;
include proxy_params;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
}
/opt/myenv/bin/gunicorn -c /opt/myenv/gunicorn_config.py socialproject.wsgi