一段时间以来,我一直在试图找出答案,但是我不确定这是怎么回事。我尝试修改.conf文件,取消对ServerName的注释,但似乎没有任何效果。
请提供一些见识。
django_project.conf
# ServerName 45.33.82.190
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/rodrez/PersonalPortfolio/static
<Directory /home/rodrez/PersonalPortfolio/static>
Require all granted
</Directory>
Alias /media /home/rodrez/PersonalPortfolio/media
<Directory /home/rodrez/PersonalPortfolio/media>
Require all granted
</Directory>
<Directory /home/rodrez/PersonalPortfolio/PersonalPortfolio>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/rodrez/PersonalPortfolio/PersonalPortfolio/wsgi.py
WSGIDaemonProcess Portfolio python-path=/home/rodrez/PersonalPortfolio python-home=/home/rodrez/PersonalPortfolio/venv
WSGIProcessGroup Portfolio
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
settings.py
DEBUG = False
ALLOWED_HOSTS = ["45.33.82.190"]
...
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
答案 0 :(得分:0)
我能够弄清楚。
我用了
sudo tail -100 /var/log/apache2/error.log
检查错误,并发现我的代码在另一个文件夹中查找密钥无法正常工作。
记住您sudo tail -100 /var/log/apache2/error.log
,以检查是否有任何Apache错误。