Question

Give 500 error in Django website

Hello I am hosting 2 django website in a same server when I run command a2ensite for both conf file both website is not working and when I run command a2ensite for one website it not giving me any error this is my conf file example1.com.conf example2.com.conf

this is internal part of example1.com.conf

WSGIDaemonProcess example1.com python-path=/var/www/example1.com python-home=/var/www/example1.com/example1.comenv
    WSGIProcessGroup example1.com
    WSGIScriptAlias / /var/www/example1.com/example1.com/wsgi.py
<VirtualHost *:80>
	
# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName www.example.com

	ServerAdmin webmaster@localhost
	ServerName example1.com
    ServerAlias example1.com
	#DocumentRoot /var/www/html

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	
	  Alias /static /var/www/example1.com/static
    <Directory /var/www/example1.com/static>
        Require all granted
    </Directory>
	
	<Directory /var/www/example1.com/example1.com>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

	
	
	
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

and this is internal part of example2.com.conf

WSGIDaemonProcess example2.compython-path=/var/www/example2.compython-home=/var/www/example2.com/example2.com
    WSGIProcessGroup example2.com
    WSGIScriptAlias / /var/www/example2.com/example2.com/wsgi.py
<VirtualHost *:80>
	
# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName www.example.com

	ServerAdmin webmaster@localhost
	ServerName example2.com
    ServerAlias www.example2.com
	#DocumentRoot /var/www/html

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	
	  Alias /static /var/www/example2.com/static
    <Directory /var/www/example2.com/static>
        Require all granted
    </Directory>
	
	<Directory /var/www/example2.com/example2.com>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

	
	
	
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Please tell me what is the problem and how to run both website in a same server.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Hi @harshku2630,

All looks alright. What I’ll recommend you is to enable both websites and check your Apache Error logs what the issue is. It will provide specific information on why are you getting a 500 error. Once you have the error, you can act upon it without a problem.

If you are not sure how to proceed, you can post the error from the error log here so that we can try and assists.

Additionally, I have a question, why did you decide to use Apache instead of Nginx for your project?