Question

Not able to serve my website on apache

Posted August 5, 2018 853 views
Ubuntu Apache Django

I had served my website on Apache server and it is Django based project. I was able to run my website from one month. Now when i have pulled my repository from github and now it is showing 500 error. When i am activating my virtual environment and i am running python manage.py runserver my_ip_address then it is showing everything proper in terminal but when i am trying to excess in my web browser then it is showing nothing. Then i have tried python manage.py runserver my_ip_address:8080 then it is working properly. When i have checked my apache server error.log|tail then it is showing some error which i am attaching error low below. I am using postgres and when i was pulling my repository for the last time then after python manage.py makemigrations it asked me to give one default time for one of my field and i have provided timezone.now. In last git pull i have changed many things but if there could have error then my python manage.py runserver my_ip_address:8080 in virtual host should not work but it is working properly. I have also restarted the apache server service apache2 restart and i have also used with sudo.

[Sun Aug 05 19:06:20.530154 2018] [wsgi:error] [pid 31141:tid 140598172460800] [remote 136.232.1.166:12161]   File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Sun Aug 05 19:06:20.530173 2018] [wsgi:error] [pid 31141:tid 140598172460800] [remote 136.232.1.166:12161]     django.setup(set_prefix=False)
[Sun Aug 05 19:06:20.530182 2018] [wsgi:error] [pid 31141:tid 140598172460800] [remote 136.232.1.166:12161]   File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
[Sun Aug 05 19:06:20.530196 2018] [wsgi:error] [pid 31141:tid 140598172460800] [remote 136.232.1.166:12161]     apps.populate(settings.INSTALLED_APPS)
[Sun Aug 05 19:06:20.530204 2018] [wsgi:error] [pid 31141:tid 140598172460800] [remote 136.232.1.166:12161]   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 78, in populate
[Sun Aug 05 19:06:20.530218 2018] [wsgi:error] [pid 31141:tid 140598172460800] [remote 136.232.1.166:12161]     raise RuntimeError("populate() isn't reentrant")
[Sun Aug 05 19:06:20.530236 2018] [wsgi:error] [pid 31141:tid 140598172460800] [remote 136.232.1.166:12161] RuntimeError: populate() isn't reentrant

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

Hello,

I could suggest following the steps here on how to serve Django applications with Apache:

https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-16-04

Also for some more information about the problem, I would suggest following the steps here on how to troubleshoot common Apache problems:

https://www.digitalocean.com/community/questions/how-to-troubleshoot-common-apache-issues-on-linux-server

Regards,
Bobby

by Justin Ellingwood
Django is a powerful web framework that can help you get your Python application or website off the ground quickly. Django includes a simplified development server for testing your code locally, but for anything even slightly production related, a more secure and powerful web...
Submit an Answer