Hi guys I am having some trouble here and so i'm asking for some advise.
I built a pyramid app, it works perfectly on localhost, now I'm uploading it to a vps and i'm running into all kinds of trouble. My site is hosted on mercurial.
please don't reference this: http://docs.pylonsproject.org/projects/pyramid/en/latest/tutorials/modwsgi/index.html
I've tried that many times and Googled a lot, that's why I'm asking the question here.
I'm on python 2.7
I now have a folder structure like this:
appname_dir/
appname_module/
static/
template/
__init__.py
views.py
keep in mind I didn't name my folders appname_dir and appname_module.
I create my app.wsgi file inside my appname_module folder it looks like this
from pyramid.paster import get_app, setup_logging
ipath = '/path/to/appname_dir/production.ini'
application = get_app(ipath, 'main')
I've tried creating a virtual host file similar to the one below
<VirtualHost *:80>
ServerAdmin contact@domain.com
ServerName domain.com
ServerAlias www.domain.com
UseCanonicalName On
WSGIScriptAlias / /path/to/my/app.wsgi
<Directory /path/to/folder/that/contains/app.wsgi>
Order allow,deny
Allow from all
</Directory>
Alias /static /path/to/app/static/folder
<Directory /path/to/app/static/folder>
Order allow,deny
Allow from all
</Directory>
ErrorLog /path/to/app/folder/logs/error.log
LogLevel warn
CustomLog /path/to/app/folder/logs/access.log combined
</VirtualHost>
that doesn't work
I've tried to add custom apache conf file similar to the one below
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess pyramid user=username group=groupname threads=6 \
python-path=/path/to/virtualenv/site-packages
WSGIScriptAlias / /path/to/app.wsgi
<Directory /path/to/appname_dir>
WSGIProcessGroup pyramid
Order allow,deny
Allow from all
</Directory>
and still no go. Typically their a 500 error with this code in the apache error log files
Target WSGI script cannot be loaded as Python module
can anyone help explain what's going on or how I can fix this. Please pointing me to other SO answers isn't helpful I've spent all day trying to figure this out.
Well I was able to solve the problem by moving away from apache and mod_wsgi, I setup nginx and uwsgi. If I need apache I can proxy connections from nginx to apache but I don't see me needing to take that route anytime soon.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.