Need a lightweight, standalone web server for Django - django

I have a Django web application which should be easy to install on Linux systems. The app does not need much performance. It is just a simple web GUI for some services. So a full-blown deployment with Apache is not needed. I am looking for a lightweight web server that has little or no configuration; just like the Django development server.
It should be possible to run it as daemon, though.
Any suggestions?

You can use Quick and dirty multi-threaded Django dev server.
But, configuring apache or fastcgi to server django applications is not a hard thing, so you should really do that.

I would use Green Unicorn with nginx, very light weight and fast. It does has some configuration unfortunately, so it might not be ideal for you, but worth checking out.
http://gunicorn.org
http://wiki.nginx.org/
Here is a blog post that explains how to set it up with supervisord.
http://kencochrane.net/blog/2011/06/django-gunicorn-nginx-supervisord-fabric-centos55/

Related

Access backend APIs in Angular/React/Vue(front-end) and DJango/Node/Java/ASP.NET(back-end)

I have searched a lot but could not find any satisfying answer.
I want to know if any IDE provides an environment for web development using Angular and Django. And how to access Django APIs in angular.
please tell me.
I will be thankful for your guidance.
The first thing that comes in mind is Visual Studio Code. It is very versatile and easy to set up for starting web development.
https://code.visualstudio.com/docs/nodejs/angular-tutorial
You have a lot of extensions which can make your life easier in developing by just typing in the search Angular. You'll finde code highlighter, debugger for chrome etc...
same goes to Django, fast easy set up, good extensions and you are ready to go.
I was not familiar with web development at that time. My question was about accessing APIs in frontend. All IDEs and Editors can be used for frontend and backend development.
The main point to keep in mind is that your frontend will have its own server and backend will have its own server that will compile and react to changes you made in your code.
Let's say your frontend server serves on localhost with port:8888 and your backend server serves your APIs on localhost with port 8000
By running both server at the same time you can access APIs in your frontend with backend routes like:
'localhost:8000/login'
localhost:8000/user/user_id

Deploy Go/Golang REST Web API on production

I am writing a backend web api for a mobile app. It should support HTTPS. Most of my experience in .NET, but for this one I want to use Go/Golang. I have a sample service ready, now I need to make sure that it is production ready.
In .NET I will just use IIS, but I have no clue what would be a good approach for Go.
Should I have nginx as reverse proxy, or I better use FastCGI ? And how to make sure that my go app is up and will run on system reboot ? should I use upstart or something similar ?
I've been using Nginx FastCGI with a Go webservice - they work well together. It's no harder to set up than HTTP reverse proxying - except for having to learn how to do it. The performance ought in principle to be a lot better, but I have no measurements to justify that hunch. My web service can work in both HTTP mode and FastCGI mode (one or other at a time), so I suppose I ought to do some benchmarking (note to self!).
If you want proper system startup (and you should), you need to learn how init scripts work. I sometimes cheat and start with an existing working script someone else wrote for a similar application and customise it to work with mine.
I've used nginx as a reverse proxy for my Go projects. I've found that it's a lot easier to set up useful server settings such as TLS, compression, etc., in nginx rather than as a pure Go server.
Keeping it alive on server reboot is a more complicated question. I would suggest learning how to write a script/whatever for your server's init daemon and just doing it that way.

Choice of server for local Django webapp?

I've put together a Django app that was intended to run on Pythonanywhere. However, I soon found out that Pythonanywhere's free plan blocks the remote sites which I intend to interact with, so I decided running the app on a local machine would be good enough for my purposes.
Now, I know that Django's development server isn't meant to be run in a production setting. So, what server daemon do I run on the aging Windows workstation the app's probably gonna be deployed to? Apache, lighttpd, Cherokee? Something else?
My first priority here is conserving system resources as much as I can; I'm probably also going to use Python's built-in sqlite3 instead of MySQL.
Personally I deploy Django with fcgi and Nginx. Nginx offers various strategies to conserve system resources; its use as reverse proxy is well documented and widely used.
The question/answer pair here might help you clear some initial questions about the various components when deploying Django.
Sorry to hear you can't use PythonAnywhere's free version :-(
I'll second the usage of nginx; it's what we use as the front-end for PA. However, we use uwsgi for the backend. It works really well for us and is very easy to configure.

Minimal production Django server on Windows

I need to deploy a small Django app to be used in a small intranet. Concurrency and speed are non issues because there will be, at most, 10 users (and I bet that there will be almost no concurrency).
There is already a MySQL server. The problem is with the Django app. What is the most lightwieght server I can install under a WinXP environment ? The Apache + mod_python approach seems a little overkill. The cherrypy server seems more suitable.
Any suggestions ? Someone with similar experiences ?
You could use IIS with PyISAPIe.
I outline my Django on Windows deployment here and also more info on PyISAPIe with Python 2.6 here.
As I'm not a big fan of IIS, I'd still use Apache + mod_wsgi. mod_wsgi is officially recommended way of deploying django apps, according to http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/
We're currently deploying a small intranet Django app to complement a closed source app on IIS to an audience of about 300-400, but low use.
We opted for cherrypy by means of django-wsgiserver, but go for the bitbucket version if you don't use the admin, there's a bug in the 0.6.10 version that's on pypi.
We have IIS as a reverse proxy in front of it, and use media from the existing app. Don't know yet if it's stable, but I like the fact that it's conceptually the same as the Apache+gunicorn setup that I use on the *nix box.
Since this question dates from 2 years, I'm very curious about your experience.
The Windows port of lighttpd also bears mention.

Is there an easy way to test SSL protected webpages in Development server, using Django?

I use Django for my website and I want to know whether there is a work around for testing secure pages in Development server. As a temporary workaround, I wont use HTTP to check the webpages in dev server, which I think is not a correct way? What do you think?
You might consider mod_wsgi, since it can be used for development, testing, and deployment. mod_wsgi can be configured to detect any changes to you make to your Python code and automatically restart, same as the development server.
I tend to do most of my development on my local machine, but use an actual reference implementation server for testing. It's running mod_wsgi under apache, with a self-signed certificate. A recent detailed article by Graham Dumpleton is available here:
http://blog.dscpl.com.au/2008/12/using-modwsgi-when-developing-django.html
This looks helpful -- using stunnel to route HTTPS requests to django dev server.
The Django development server is very basic and intended for local testing only. It does not support ssl/https. You'll have to run it using Apache, NGINX, or some other web server that supports SSL in order to test.
You can now use FakeSSLMiddleware