So I've been tasked with upgrading a Django server from 1.6.2 to the latest (~1.8), along with upgrading Python from 2.7.3 to 3.3. I suspect this is going to break quite a bit of code. (I even need to upgrade the Ubuntu installation from 12.04 to 14.04)
I would like to migrate my Django app from the server it's currently running on (Ubuntu 12.04) to a virtual machine, and use that environment as a sandbox to make changes.
Would anyone be so kind to provide guidance on django app migration? Please let me know if you'd like me to provide any specific details.
Thank you.
Edit: If anyone would like to vote down this question because they believe I haven't done enough research, I'm very happy to add missing information, if I know what you're looking for.
Django versions from 1.5 onwards has been designed so that the same code will work on both versions of Python as in the documentation thanks to them following the six compatibility layer.
You might face some issues with code that isn't strictly related to Django components like print statements and other such parts that might have been coded in. The official Python Porting Guide should held you with that.
Django 1.8 is a LTS (Long Term Release) so it's a good idea to upgrade to it. Migrating the database might be a bit of an issue considering it's from 2.7 to 3.4 but that's in all likelihood the place you'll find most issue with. The How to Migrate is a great resource.
If I recall correctly the directory structure is a bit different in 1.6 so you'll have to move some code and files manually. I suggest having the tutorial pages for both versions 1.6 and 1.8 open and comparing the directory structure.
Going through the first 2 pages of the tutorial should give you enough of an overview to migrate the database and the settings file. This should also help with migrations.
The 3rd and 4th pages should get you through migrating the views and urls files.
The only thing I'm not familiar with is the migration of the wsgi file which has configuration information, you should be able to find some basic information about that here.
Updating your Ubuntu however won't change or affect anything at all.
Also as has been said in the comments by jape and joel, it's a good idea to use virtualenv and git.
I would like to add another suggestion based on my own experience with pushing code to a Django server :
Download the code base to your local machine and work there and once you're done and the server is working well on your machine push it all to the server at once. That way you can isolate server machine specific issues from coding issues.
Related
First off, I know similar questions have been answered, but I can't find any solutions for my particular constraints. If there is one, please point me to it.
I'm trying to start a django project. However, I can't run the development server. The problem seems to be the SQLite version. I have 3.7.17 installed, django requires 3.9 or later. So I need to upgrade it. The problem is I'm using one machine from many, used by multiple developers all working on different projects, but sharing the same global python packages. So whatever changes I need to make, need to be inside my venv. And I don't have root access on the machine. Also, I don't plan on using SQLite as the DB for the project, so if that means I can somehow bypass this requirement, that would be fine as well. However, I assume, in that case I'll need to somehow transfer the django admin app to my DB of choice as well?
Note: I'm quite new to web development or programming in general, so a dumbed down explanation would be greatly appreciated. Thanks.
i have some reasons witch i am stuck to use django on windows machine. i was wondering how to configure django on a windows sesrver 2012 r2 with iis 8.5. so i followed the tutorial here.
i did what the tutorial says and it is pretty much straight forward what i am gonna do for any kind of application i want to run with iis.
but i get the following error the fastcgi process exited unexpectedly.
here is what i have provided as executable for wfastcgi module:
E:\venvs\...\Scripts\python.exe|E:\venvs\...\Lib\site-packages\wfastcgi.py
i removed the wfastcgi.py part after | from handler mapping and error changed to script processor could not find the config for fastcgi configuration and i figured out the error must be related to the wfastcgi.py file. but i could not find the issue here. so i was wondering what can be the issue? and what are my options are here.
has any one been able to use django on a windows machine?? jsut in case my python version is python 3.6
I had the exact same problem as you but managed to solve this by using Python 3.4.2 version. Follow the exact steps as described in this tutorial Django with IIS and avoid using Python 3.5 or above because it seems that there are compatibility issues. The stack I used was IIS version 10, Windows 10, Python 3.4.2 and Django 1.11.2.
Upgrading wfastcgi to the latest version
pip install wfastcgi --upgrade
solved it for me: Python 3.6.6, wfastcgi 3.0.0
In my Case I was facing the same issue i.e. enter image description here
Mine is a Django App used for APIs that queries data from back-end platforms. This issue was only for specific filters that the API was using in queries while for other values in filters it worked great.
My Config file did not have a fastCgi tag and I added below mentioned part to top of system.webServer in config file. Yes off course it gave few errors here and there corresponding to activityTimeout and requestTimeout. Tried increasing up-to 900 and 601 respectively and then it worked for me. But could not understand cause of the issue as query that API was running for which i was facing this issue was not taking that long at all. I would like to understand that.
<fastCgi>
<application fullPath="D:\Python34\python.exe|D:\Python34\Scripts\wfastcgi.py"
arguments=""
maxInstances="4"
idleTimeout="300"
activityTimeout="900"
requestTimeout="601"
instanceMaxRequests="10000"
protocol="NamedPipe"
flushNamedPipe="false">
</application>
</fastCgi>
I'm about to create a new custom Django app for my organization. (I'm a brand new Django developer; this will be my first one apart from the occasional "Hello world" I've done as a prototype.)
I'm on a shared hosting provider, which indicates that for Django applications, we should use Django version 1.8 (even though 1.10 is the current version) because 1.8 is the last version that supports FastCGI. Am I setting myself up for having a worthless app a few years from now once 1.8 is no longer supported? Would one expect that by the time 1.8 is no longer supported, the shared web hosting world will have moved on to WSGI or some form of workaround? Or is that a fundamental impossibility? Will I find in a couple of years that I've developed an application that is unusable on the host I've produced it for?
Alternatively, should I be considering some other development tool for the situation I'm in? I'm on a shared host, and I'll be doing a fairly vanilla web front end / database back end style setup.
Am I setting myself up for having a worthless app?
Nope. You will have your project working, and if you ever want to upgrade and find it difficult to jump 3 version at once (1.8 LTS to 1.11 LTS) you can do it step-by-step with neat deprecation warnings. Though general compatibility between versions is usually very good. You will probably also want to have requirements.txt to recreate your virtualenv, and then just dropping away the fcgi trash.
... the shared web hosting world will have moved on to WSGI ...?
They will have to if they want to earn money. It is also quite easy to configure so there's no other "fundamental impossibility" than laziness.
Should I start a new Django app with version 1.8?
I cannot decide for you. I would rather consider changing my hosting. On the other hand there's handful of popular extensions that didn't successfully migrate their master to 1.10 yet (e.g. grappelli), which could also cause delayed migration of your own projects.
Should I be considering some other development tool?
Too general. Ever seen Flask? It's neat, but Django comes with more features out of the box.
I'm new at both Python and Django and still trying to figure out the best environment for my development. As far as I saw, there are 2 options available for establishing a connection to a MSSQL database which are:
Django MSSQL Database Backend: http://django-mssql.readthedocs.org/en/latest/
Django PYODBC: https://github.com/lionheart/django-pyodbc/
What I want to ask is the difference between those 2 options and their pros/cons over each other. Do they differ from each other especially in terms of performance and stability?
(I have only found the link below in stackoverflow but it was quite limited and outdated so I've wanted to ask another question. Sorry if there are any recent ones that I haven't seen yet.)
django-pyodbc vs django-mssql
Thank you.
I chose django-mssql when I started my project two years ago, as it is optimized specially for SQL Server whereas django-pyodbc relies on pyodbc which is a generic ODBC driver.
Of course there are some bugs, but the package is actively maintained. So far it does the job very well for me.
The main downsides :
Only runs on Windows (depends on pywin32 package)
Django version support far behind latest (current stable version supports Django 1.7, and development version is for Django 1.8...)
Migrations are a little buggy. You may have to alter generated sql by yourself in some cases.
django-pyodbc seems to support latest Django version and is cross-platform, however I have not found any positive opinion of people that use it in production back when I had to choose between the two.
I am new to web development. So be gentle. AND thanks in advance.
I am developing on windows env. and deploying on a linux server w/ Python 2.6.2 installed.
Running apache2.2 as Virtual Host, and I am using mod_wsgi. I plan to serve media files from the same Virtual Host.
I have a django site and I am now ready to deploy. I am stuck, and every site I go to seems to be outdated/incomplete/overmyhead.
https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/
http://www.djangobook.com/en/2.0/chapter12/
...only 2 links as for the newbness
The top link seems to be what I need yet I am still confused on these things:
What does the file structure look like on the server
I cannot change/edit server files myself, I rely on the dba for that
I have django.wsgi, and django.wsgi~, where do those go?
Where do I put my project in relation to those wsgi files?
The httpd.conf file is something that the server has on it? or do I create another?
Do I need to put django in any way shape or form on the server? If so where? And what about the packages like registration, defaults?
Again sorry for the newbness, I have been banging my head for 2 weeks on this.
Any help/links will be greatly appreciated unless they link me to the django-docs. I have read those...A LOT! thanks
Also go read:
http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
and watch:
http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations
The latter includes Django examples and talks a bit about locations, permissions etc.
The first of these is even linked to in the document in the Django documentation.
It doesn't matter where the files go. They just have to be readable/executable by the user that the web server is running under.
I don't know what you mean by django.wsgi~, that sounds like a backup file created by your editor - you don't need that.
Yes the httpd.conf is the configuration file for Apache. Some distributions (eg Debian and Ubuntu) split this up into separate files for each site that the server runs. If your administrator is the only one who can edit files, he will know about this already.
Yes, you need Django, and any third-party packages.
#Nathan
An easier option for you while you are learning this is not to really have to many expenses.
I could also suggest you take a look at Heroku - allows you to easily deploy your applications in minutes.
Up until recently they only supported RoR and they have brought in support for Django and Python - they have some really well documented tutorials as well.
I hope this helps
Heroku Django / Python tutorial
I have written up an simple deployment guide for django applications it can be found here. It goes all the way from project setup and deployment. I also have references setup. I honestly believe it answers all your questions, I would give it a look.
Goodluck.