简体   繁体   中英

Django Deployment 500 Internal Server Error - Apache2

I have been trying to figure this out for a while but I am not sure of what it's wrong. I have tried modifying the.conf file, uncomment the ServerName but nothing seems to work.

Please provide some insight.

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/')


I was able to figure it out. I used sudo tail -100 /var/log/apache2/error.log to check for the errors and found that my code to look for the key in another folder was not working properly.

Remember you sudo tail -100 /var/log/apache2/error.log to check for any apache errors.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM