Has anybody got recent experience with deploying a Django application with an SQL Server database back end? Our workplace is heavily invested in SQL Server and will not support Django if there isn't a sufficiently developed back end for it.
I'm aware of mssql.django-pyodbc and django-mssql as unofficially supported back ends. Both projects seem to have only one person contributing which is a bit of a worry though the contributions seem to be somewhat regular.
Are there any other back ends for SQL Server that are well supported? Are the two I mentioned here 'good enough' for production? What are your experiences?
Django has a built-in web server that is used for development purposes. The framework supports several database management systems including Microsoft SQL Server.
If you want to run Django 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. If you plan on running on Heroku, a web server is provided implicitly. You don't have to take care of it.
PostgreSQL notes. Django supports PostgreSQL 11 and higher. psycopg2 2.8. 4 or higher is required, though the latest release is recommended.
Long answer: It is said you can't use SQLite in production because it doesn't support concurrency (no more than one user can be writing to the database at the same time) and it can't scale. But let's be pragmatic. Many applications are used only by a few users.
As has been stated, django-pyodbc is a good way to go. PyODBC is probably the most mature SQL Server library for Python there is.
The only thing you may have problems with is that pyodbc doesn't support stored procedures very well (you can call them, but you have no way to get results from them). You can call them using pymssql, but I would avoid it if at all possible as it doesn't support the standard DB-API interface and may be subject to changes. If you need to do this, your best bet is to use adodbapi directly (it's included with the python win32 package, which you'll probably end up installing anyway).
These days
./manage.py migrate
EDIT: Here are the package versions
Django==1.11.6 django-mssql==1.8 pyodbc==4.0.19 django-pyodbc==1.1.1 django-pyodbc-azure==1.11.0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With