我正在尝试部署我的第一个网络应用程序,但我对此一无所知。这很有趣,但当我尝试解决问题时,我觉得我不知道自己在做什么。
我在 digital ocean 上创建了一个在 ubuntu 18.04 上运行的服务器,在过去的 2 天里我一直在与它斗争,以使我的网站顺利运行。
我现在觉得结束已近,但我陷入了权限访问问题。
我的应用程序正在通过烧瓶运行。我正在使用 wsgi_mod 和 apache 来运行它。
我已经写下了 2 个可以帮助您的安装文件(我想?)以及错误日志。
我还尝试应用以下修复:
sudo chown -R www-data:www-data /var/www/website.com
须藤 chmod -R 775 /var/www/website.com
我尝试使用 WSGI Daemon 进程运行 wsgi(无论它用于什么用途,都不起作用)。
请帮我 !
如果您需要更多问题,请告诉我。
提前谢谢了 !
错误日志:
Traceback (most recent call last):
File "/var/www/website.com/wsgi/website.com.wsgi", line 10, in <module>
from __init__ import app as application
File "/var/www/website.com/akb/__init__.py", line 19, in <module>
flask_session.Session(app)
File "/var/www/website.com/akb/env3.7/lib/python3.6/site-packages/flask_session/__init__.py", line 5$
self.init_app(app)
File "/var/www/website.com/akb/env3.7/lib/python3.6/site-packages/flask_session/__init__.py", line 6$
app.session_interface = self._get_interface(app)
File "/var/www/website.com/akb/env3.7/lib/python3.6/site-packages/flask_session/__init__.py", line 9$
config['SESSION_USE_SIGNER'], config['SESSION_PERMANENT'])
File "/var/www/website.com/akb/env3.7/lib/python3.6/site-packages/flask_session/sessions.py", line 3$
self.cache = FileSystemCache(cache_dir, threshold=threshold, mode=mode)
File "/var/www/website.com/akb/env3.7/lib/python3.6/site-packages/werkzeug/contrib/cache.py", line 7$
os.makedirs(self._path)
File "/usr/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/flask_session'
/var/www/website/wsgi/website.com.wsgi
#!/var/www/website.com/akb/env3.7/bin/python
# -*- coding: utf-8 -*-
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/website.com/akb")
from __init__ import app as application
application.secret_key = 'iuhAqshdad123_&é"_JIHfduh3i123d!!:'
/etc/apache2/sites-available/website.com.conf:
WSGIPythonHome /var/www/website.com/akb/env3.7
<VirtualHost *:80>
ServerName website.com
ServerAdmin [email protected]
ServerAlias www.website.com
DocumentRoot /var/www/website.com/akb
<Directory /var/www/website.com/akb>
<IfVersion < 2.4>
Order allow,deny,
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Directory>
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /var/www/website.com/wsgi/website.com.wsgi
<Directory /var/www/website.com/akb>
WSGIProcessGroup website.com
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Directory>
Alias /static /var/www/website.com/akb/static
<Directory /var/www/website.com/akb/static>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Directory>
Alias /templates /var/www/website.com/akb/templates
<Directory /var/www/website.com/akb/templates>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Directory>
ErrorLog /var/www/website.com/errors/error.log
LogLevel info
CustomLog /var/www/website.com/errors/access.log combined