By dillon458961
Hello,
I’m trying to deploy a flask application on my droplet, which is running ubuntu, but every time I change my virtual host file to the domain, it just serves the index of /var/www/html and not the wsgi which I specified in the virtual host file. However, if I use my droplet’s IP for “ServerName”, it works fine.
Any ideas?
Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Like I was saying, the virtual host file works with the IP, but not the domain. Here it is though:
<VirtualHost *>
ServerName 192.241.184.178
ServerAdmin admin@testing.com
WSGIScriptAlias / /var/www/html/Training/training.wsgi
<Directory /var/www/html/Training/Training/>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/html/Training/Training/static
<Directory /var/www/html/Training/Training/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
When I replace “ServerName” with “training.fstichem.com”, it just displays the folders.
Could you post your Apache VirtualHost? Have you set WSGIScriptAlias ? It should look something like:
<VirtualHost *>
ServerName example.com
WSGIDaemonProcess yourapplication user=user1 group=group1 threads=5
WSGIScriptAlias / /var/www/yourapplication/yourapplication.wsgi
<Directory /var/www/yourapplication>
WSGIProcessGroup yourapplication
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Also make sure that mod_wsgi is installed:
sudo apt-get install libapache2-mod-wsgi
sudo a2enmod wsgi
sudo service apache2 restart
Check out Flask’s docs on using it with Apache.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.