As far as I understand, fiware-bosun uses Django server. However, is it possible to deploy it using a different application server (e.g. Apache)?
Fiware-bosun is compound by two different modules:
Fiware-cloto: The Rule engine which uses Django server with WSGI.
Fiware-facts: the server to process the incoming facts, which uses Flask + Gevent with WSGI.
Both components are recommended to be deployed using gunicorn and you could also add supervisord and Nginx over this layer.
However, of course you can deploy the rule engine using any other application server that supports WSGI (e.g. Apache + mod_wsgi).
Related
I implement a Django website behind a NGINX configured as reverse proxy which serve also the static for Django when it is out of debug mode, all this is in a docker-compose app.
I know by read the Django docs they do not recommend to use integrated web server in a production environment (and it is not at the moment), put it behind a reverse proxy is acceptable to avoid security issue or it is the same as expose it directly?
If it is not an acceptable solution, could you suggest any implementation to not use the Django integrated web server?
Consider that the container structure like the following:
Proxy is the NGINX Official image
www1 & www2 are Python3 Official image with Django installed as described here.
database is the Postgres Official image.
Only the Proxy container is exposed to the external world.
Thanks.
I get my answer, I gonna use gunicorn instead the integrated Django web browser.
I had use documentation present here That describe how to configure gunicorn and nginx on the same host, but using http instead linux socket, instead the command to run the Django integrate web server I have just to run gunicorn like this:
gunicorn --workers=4 --bind=0.0.0.0:9000 --access-logfile - --error-logfile - --log-level debug myapp.wsgi:application
with the previous command I also get logs managed by container.
Off course I also add gunicorn in the requirement file.
I hope this question will help also some one else.
I'm new to web development and deployment however I developed a web site using Python 2.7 and Flask. I can't get the site to load when the user hits the site. When testing on the server using SSH the program starts like it did on my development PC but does not render the first template and shows this error: WARNING: Do not use the development server in a production environment. Use a production WSGI server instead.
In researching that error I found an article that says Flask is not meant for a multi-user public web environment. Further investigation said: If you want to run Flask in production, be sure to use a production-ready web server like Nginx, and let your app be handled by a WSGI application server like Gunicorn.
I think what this is telling me is:
Find a provider that supports Nginx.
Install Gunicorn and then configure it to run on that host.
Doing that should allow my program to run on the host server and be accessible to the world.
Would folks with experience with Python/Flask web apps please confirm the direction I should be heading as I can't afford to go down the wrong path again.
How running django-jython on FastCGI in Nginx?
Short answer: You can't.
Although nginx can be used as a lightweight web server, its main strength is that it is a very good reverse proxy and it is used primarily in this role.
You'll need to run your application in a servlet container (like tomcat), and then have nginx proxy to it.
See the running django on jython section at the django documentation.
I have recently switched to Django for a web app I'm developing and I followed the instructions at Heroku for getting a Django app running on Heroku. I have a virtual environment in which my app is developed and I use git for version control and to push to Heroku. The link above suggests that I intall gunicorn:
The examples above used the default HTTP server for Django. For
production apps, you may wish to use a more production-ready embedded
webserver, such as Tornado, gevent’s WSGI server, or Gunicorn.
They then walk the user through installing Gunicorn.
My question is: what problems might I run into if I skip this step and just stay with the default? What benefits will Gunicorn give me?
Gunicorn is production ready and really easy to use. I use it for my websites. You usually should run it via a reverse proxy like Nginx. I'm not sure what Heroku is using. You really should try it.
In my experience it's much easier to use and configure than apache & mod_wsgi, and the other similar setups.
edit/update:
As a summary of the comments below, Heroku already uses Nginx as a reverse proxy
Much better performance, and probably better security and stability, too. Django's development web server (which is used by Heroku by default) isn't really designed to serve production applications.
django's server, is a development server . It is light weigh and easy to use but should not be used in production because it is not production ready. it cannot handle many requests. This link offers a comparison between gunicorn, uwsgi and django's development server.
Essentially,
I am doing some of the development for my Django app straight on my shared server rather than on a local machine (I know that initially is the problem) however regardless, I would like to know if there is a way to restart the apache server on my shared hosted server (Bluehost) for when I modify any of the python files.
I'm not sure how the Django framework is setup, maybe restarting the webserver is not needed?
THanks!
How is the apache configured to run python codes? are you using fcgi, wsgi or something else?
What i do is, i use a fcgi process and restart fcgi process without the need to restart the webserver. In my case web server is nginx but it should be same in apache if you are using fcgi.