First we run our flask app into a apache server, so we need to configure apache server. A full tutorial can be checkedhere
wsgi file
#!/usr/bin/pythonimportsysimportlogginglogging.basicConfig(stream=sys.stderr)sys.path.insert(0,"/var/www/")fromsrc.runimportappasapplication
App python
importsyssys.path.insert(0,"/var/www/")fromapp.applicationimportExampleApifromconfigimportConfigurationcfg=Configuration(debug=False)app=ExampleApi(cfg)if__name__=="__main__":app.run(host=cfg.host,port=cfg.port,debug=cfg.debug)
Dockerfile
FROM ubuntu:12.04MAINTAINER Andrés Baamonde LozanoRUNapt-get update&& apt-getinstall-y apache2 libapache2-mod-wsgi python-dev python-pip&& apt-get clean&&rm-rf /var/lib/apt/lists/*RUNpipinstallFlask#enable mod_wsgiRUNa2dissite defaultRUNa2dissite default-sslRUNa2enmod wsgiENV APACHE_RUN_USER www-dataENV APACHE_RUN_GROUP www-dataENV APACHE_LOG_DIR /var/log/apache2COPY src /var/www/src#Creamos el virtual hostCOPY resources/docker/app /etc/apache2/sites-available/appflaskRUNchown-R www-data:www-data /var/www/srcRUNchownwww-data:www-data /etc/apache2/sites-available/appflaskRUNa2ensite appflaskEXPOSE 80CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
You can check full application at mygithub
Top comments(0)
Subscribe
For further actions, you may consider blocking this person and/orreporting abuse