Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
A template for deploying a flask app to apache server.[NOT A QUESTION RATHER A SOLUTION]
Has anyone had a nightmare deploying a flask app to apache. I have created a template for flask app that has all the folders required including the css and js files for twitter bootstrap. I have also included a .wsgi file and a user guide for deployment. The template assumes all apache2 prerequisites have been installed.
I have not tried deploying to a mac environment so i cannot comment much about that. In terms of the Virtual host, its good to have separate virtual host for each app. You could try having many Virtual hosts within the same httpd.conf file. Once you restart the apache2 server you should be able to tell if the Virtual host sections are all fine, as if not, you will see errors. Yes you can deploy your Flask app and wsgi to its own folders long as your paths are all correct i.e your Virtual host path points to the correct Flask app. I have deployed multiple Flask Apps on one server with no issues. In terms of Virtual environment, i recommend you create a virtual environment for each app so resources dont conflict with other apps. In regards to the imports, app is the app.py file from the root of that folder. I would also keep all the lines of code in the wsgi file especially the line that activates the virtual enviroment. I have made amends to my template on github so you might want to have a look at it again.
hope that helps you