Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMayur Pande
Courses Plus Student 11,711 PointsHow to deploy a flask app to a live ubuntu server
I am going crazy trying to figure out how to deploy a flask app to a web sever. I have followed all the instructions and it is still not working.
I do not have a domain so I am only accessing it through the ip address.
So far my wsgi
file looks like this;
#!/usr/bin/python3
import sys
activate_this = '/var/www/WebScraper/WebScraper/venv/bin/activate_this.py'
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
sys.path.insert(0,'/var/www/WebScraper/')
from WebScraper import app as application
and my enabled site apache file looks like this;
<VirtualHost *:80>
ServerName xx.xxx.xxx.xxx
WSGIDaemonProcess /var/www/WebScraper/WebScraper user='user' group='group' threads=5
WSGIScriptAlias / /var/www/WebScraper/webscraper.wsgi
<Directory /var/www/WebScraper/WebScraper/>
WSGIProcessGroup WebScraper
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
my directory structure looks like this;
|--------WebScraper
|----------------WebScraper
|-----------------------static
|-----------------------templates
|-----------------------venv
|-----------------------__init__.py
|----------------webscraper.wsgi
Sorry for the hassle but can you see anything obviously wrong? Kenneth Love
1 Answer
Ken Alger
Treehouse TeacherMayur;
Are you getting any errors or warnings anywhere, log files, command line, etc.?
Is the Ubuntu server (version ??) self standing or is it through a cloud service like AWS?
Have you tried restarting the Apache (version ??) service? Are there any messages that come from that process?
Have you tried swapping the Order
parameters to allow, deny
? Take a look here under Order Directive for settings.
Post back with further information or if you are still stuck.
Mayur Pande
Courses Plus Student 11,711 PointsMayur Pande
Courses Plus Student 11,711 PointsHi Ken Alger
So the errors I am getting are;
The ubuntu server is 16.04. My friend bought it from some place in China I think. All he gave me was the ssh@xx.xxx.xxx.xx and the password.
I have tried checking the status of the apache2, and it is running, green light.
Also as you suggested I swapped the orders parameters, but still getting those errors.
It seemed so simple when I set it up locally on my local host, but when actually trying to upload it to a live server there are some many differences/difficulties!