Django python manage.py runserver [closed] - django

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I heard that it is not recommended to use
python manage.py runserver
in a productive environment. How come ?

The built in Django server is designed for development purposes only. In an actual production environment you'll want to use a robust and powerful alternative, ranging from Apache to nginx using WSGI or mod_python etc.
From the documentation
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that’s how it’s gonna stay. We’re in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.)
A popular setup is keeping nginx in front of Gunicorn, which is a WSGI server.

Related

Self-host a Django Website [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Is it possible to host a website built with Django on one's personal machine? If so, how?
I built a small Django site, my first, based on a tutorial, and I want to make it live, so that I can see how it looks on other computers/devices, and allow friends/family to check it out. I have no way of purchasing a server.
A way to do what you're asking for is by using ngrok on your machine (using homebrew on a mac, brew install ngrok)
You would need to sign up at https://ngrok.com/signup to get an authtoken to password protect your site.
Install the authtoken: ngrok authtoken your_authtoken_here
To run your django app in your terminal, you would run (note that you could specify a different port; Django runs on 8000 by default):
python manage.py runserver
And then in another terminal window you would run:
ngrok http -auth='username:password' 8000
You'll see a screen with a line that looks like this:
Forwarding http://sfd98sdf.ngrok.io -> localhost:8000
You can then visit http://sfd98sdf.ngrok.io to view your site.
You would have to keep your machine running these processes for this to work.
Note that as commenters have said, this isn't the best or most secure way, but it's a quick way to do exactly what you want to do.

Possible to host a django site on github pages? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I'm new to django, and have a small finished project I'd like to publish online. Is it possible to host my site as a github project page, or do I have to use a service like OpenShift?
You can deploy Django on a physical server or VPS (see the deployment docs). You don't have to use a a platform as a service like OpenShift or Heroku.
It is not possible to host a Django site on Github pages. Github pages is for static sites, whereas Django requires Python to generate pages dynamically.
If you do not want to use OpenShift, but instead would prefer a more python-centric environment, I just discovered PythonAnywhere today. They appear to allow you to host Django websites and you can even use it for the Django tutorial.
Honestly, that may depend on whether you can make a static site using django, because GitHub will work for you if you have a static site.

Confused about making Django Asynchronous (RealTime) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Better Technology to Make a Django project Asynchronous (RealTime) (using Tornado with django ORM or Node.js ),
Node.js is really Tough to code.
I followed a tutorial : Using Django Inside the Tornado Web Server.
[http://lincolnloop.com/blog/2009/sep/15/using-django-inside-tornado-web-server/][1]
Solution :
i've developed a package for django called django-realtime . It may be helpful for other devs facing the same issue i have faced before
https://pypi.python.org/pypi/django-realtime/1.1
Django IMO shouldn't be used as an Asynchronous application, it's not designed for that. If you want a real time application using things like web sockets you'll need to separate your concerns.
I'm building a real time application with Django as the MVC framework for serving the site and any RESTy API calls, Gevent SocketIO as the Web Sockets Server for the real time bit and Redis Pub/Sub (will switch out for ZeroMQ) as the message transport for various different parts of the application to comunicate with the socket server and emit events.
Take a look at https://github.com/abourget/gevent-socketio. It does have a Django integration component but imo it's a bit magical, I would use it to build a separate web socket server, keep things simple.
Django and Celery are well working together.
You'll find on the web many infos, but the best places to look are
the Celery Website : http://www.celeryproject.org/
the Django-celery module : https://pypi.python.org/pypi/django-celery
But using Celery is really not mandatory. Since Django can operate any of the Python modules (or near), you can simple use RabbitMQ (as a broker) and use amqp (https://pypi.python.org/pypi/amqp) which is a fork of amqplib (https://pypi.python.org/pypi/amqplib).
Basically, any how-to you'll find about Python + AMQP should work for Django.

I want to deploy more django websites on single server. Is apache with virtualhosts my only option? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I want to have multiple django websites on a single server.
I have done this with php and apache's virtualhosts.
But how do I do this with django?
Can I make use of gunicorn or other python wsgi solutions, or do I have to use apache?
What are the pros and cons of apache and other solutions in this case?
What are caveats?
To do this with apache you can use multiple virtualhosts just like in php
I asked a question on how to do this on serverfault found here

Django project hang on the production server [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have put an updated version of the previous django project on to the server running httpd, wsgi. When I tried to open the site, the server just hang up here, after more than 5 minutes gives me 500 error. I have checked apache error log, nothing suspicious shows up. When I restored the previous version, it works fine.
In the updated version, I only add one application which using rpy2 to do some statistics.
By the way, everything is fine using the development server.
Any suggestions?
If it is the only Python site on that Apache and presuming you are using mod_wsgi, try adding:
WSGIApplicationGroup %{GLOBAL}
The third party module you are using likely has a C extension component which isn't implemented so as to be used in Python sub interpreters.
That directive forces uses of the main Python interpreter.
See documentation:
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API