-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"No module named simple_wsgi" when deploying following the documentation #420
Comments
a module of that name needs to exist and be importable by Python. The docs are a bit out of sync but it very straightforward django and Python deployment. Make sure the files that you import exist in the location that they are imported from - that is they are also on Python path. |
Well, after more work, I've made some little steps. Here is what I did: cp live/staging.env live/deploy.env
cp live/staging.py live/deploy.py
# Replace the value of DJANGO_SETTINGS_MODULE to "live.deploy" thanks to http://stackoverflow.com/a/5955623/535203
sed -i -e '/DJANGO_SETTINGS_MODULE=/ s/=.*/=live.deploy/' live/deploy.env
[[ -n "$BIOSTAR_HOSTNAME" ]] && sed -i -e "/BIOSTAR_HOSTNAME=/ s/=.*/=$BIOSTAR_HOSTNAME/" live/deploy.env
source live/deploy.env
biostar.sh init import
waitress-serve --port 8080 biostar.wsgi:application Now it nearly works: the dynamic part of Biostar is served correctly, but the static files result in HTTP 404 errors.
It seems to be due to the fact that Biostar uses an old version of Django (1.6.11) so we can't use Whitenoise. So once again, the "Low trafic deployment" part of the documentation is not usable as is. |
I've finally passed by a Here it is: source live/deploy.env
# Nginx config based on http://docs.gunicorn.org/en/stable/deploy.html and https://github.com/ialbert/biostar-central/blob/production/conf/server/biostar.nginx.conf
tee "$LIVE_DIR/nginx.conf" <<EOF
worker_processes 1;
user nobody nogroup;
# 'user nobody nobody;' for systems with 'nobody' as a group instead
pid /tmp/nginx.pid;
error_log /tmp/nginx.error.log;
events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # set to 'on' if nginx worker_processes > 1
# 'use epoll;' to enable for Linux 2.6+
# 'use kqueue;' to enable for FreeBSD, OSX
}
http {
include /etc/nginx/mime.types;
# fallback in case we can't determine a type
default_type application/octet-stream;
access_log /tmp/nginx.access.log combined;
sendfile on;
upstream app_server {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response
# for UNIX domain socket setups
server unix:/tmp/biostar.sock fail_timeout=0;
# for a TCP configuration
# server 192.168.0.7:8000 fail_timeout=0;
}
server {
# if no Host match, close the connection to prevent host spoofing
listen 8080 default_server;
return 444;
}
server {
# use 'listen 80 deferred;' for Linux
# use 'listen 80 accept_filter=httpready;' for FreeBSD
listen 8080;
client_max_body_size 5M;
# set the correct host(s) for your site
server_name $SITE_DOMAIN;
keepalive_timeout 25s;
# path for static files
root $LIVE_DIR/export/;
location = /favicon.ico {
alias $LIVE_DIR/export/static/favicon.ico;
}
location = /sitemap.xml {
alias $LIVE_DIR/export/static/sitemap.xml;
}
location = /robots.txt {
alias $LIVE_DIR/export/static/robots.txt;
}
location /static/ {
autoindex on;
expires max;
add_header Pragma public;
add_header Cache-Control "public";
access_log off;
}
location / {
# checks for static file, if not found proxy to app
try_files \$uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
# enable this if and only if you use HTTPS
# proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host \$http_host;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
proxy_pass http://app_server;
}
}
}
EOF
gunicorn -b unix:/tmp/biostar.sock biostar.wsgi &
# Start Nginx in non daemon mode thanks to http://stackoverflow.com/a/28099946/535203
nginx -g 'daemon off;' -c "$LIVE_DIR/nginx.conf" |
I'm trying to deploy biostar following the documentation.
I'm running into 2 issues:
The files
live/deploy.env
andlive/deploy.py
don't exist so I copiedlive/staging.env
andlive/staging.py
tolive/simple.env
andlive/simple.py
like indicated.When I run
waitress-serve --port 8080 live.deploy.simple_wsgi:application
, I've got the following error:So I copied those to files to
live/deploy.env
andlive/deploy.py
. This time I've got:Then I copied
biostar/settings/base.py
tolive/deploy.py
and this time I've got:So I deleted line 8
from .logger import LOGGING
and this time got:It exists a stackoverflow on the same subject, and also a similar issue (#311) which seems to be never treated.
I also tried to run
waitress-serve --port 8080 live.deploy:application
after my copies tolive/deploy*
files and got:And if I run
waitress-serve --port 8080 live:deploy
, I've got the messageServing on http://0.0.0.0:8080
, but when trying to access to the deployed website, it answers with an HTTP 500 and the following logs in thewaitress-server
command output:I think the documentation lacks some precise instructions to do the deployment correctly.
The text was updated successfully, but these errors were encountered: