Migrate web2py project to a newer version - python

I got an extensive web2py project which is currently still running on web2py 2.0.9 .
I would like to migrate it to the newest version 2.14.6 to get the more extensive bootstrap options and more styling possibilities.
What would be the things I would most likely run into and what would be the best course of action?

Related

official support of MongoDB in django

I want to use the MongoDB database in Django.
Officially there are no Django-MongoDB drivers available. I found some third-party sources, but they're outdated. I found some projects on GitHub, but they are also outdated (last updated 2-3 year ago).
What are my option? Is there any official support for MongoDB in Django?
This tutorial looks like best solution at this point.
You need to install django#nonrel and djangotoolbox so non-relational db can work properly on your django project.
After installing mongodb-engine just activate it in settings.py file

Django migration discovery - get migrations from a different directory

Lets say i have the same django project (multi-tenant project) in different code version, version a and newer version b. version b has some new migrations. I'm currently running version a on my production environment and want only to migrate the DB to the new version (the migrations are as such that it won't cause problems for version a to run correctly). so up until now, i would clone the repository with the new version b and run on it manage.py migrate and all is well.
The problem is that now, version a can make new tenants (which means new schemas). - each new schema runs the migrations of the current version so in potential, there is a situation where a schema is created with the migrations of version a although version b ran its migrations and the DB is one step ahead.
Looking for:
I would like to have a configuration so that the command migrate_schemas of the manage.py of version a will migrate against the code base of version b. Is this possible?
Tech stuff
Django 1.8
django-tenants 1.1.7
python 2.7.6
Thanks!

Upgrade Django from 1.6.2 to latest version (~1.8)

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.

What is the difference between syncdb and migrate?

I am going through django documentation. And here I have a situation. In one of the documentation, I am told to do
python manage.py migrate
And in the other
python manage.py syncdb
I can't do the first one(Error: no migrate command found.) but second works fine for me. Is this a version issue or I need to take care of something else.
The migrate command is new in the upcoming Django 1.7, which hasn't been released yet.
For earlier versions you can use syncdb, or the external app South.
When you're reading the documentation, use the Documentation version switcher to select the correct version.
For example, the current 1.6 Tutorial uses syncdb, but the dev tutorial (written for the upcoming 1.7) uses migrate.
The command migrate belongs to an application called south (http://south.aeracode.org/).
From the website:
This is South, intelligent schema and data migrations for ​Django projects.
Prior to Django==1.7 you had to install a third party application in order to perform database migrations.
Please see documentation at readthedocs
It depends what version of the documentation you are reading. migrate is the command from South which up until the latest (currently development, or dev) version of django was a separate app. It's finally getting integrated into Django (basically every django project uses it anyway as a matter of course, so it is well worth reading up on).
In the bottom right of the django documentation page there is a selector where you can switch between different versions of Django, so if you're looking for information for your project it is a good idea to change to the version of Django you're currently using.

How do I setup a local Django development environment on Ubuntu?

Finally made the switch from Windows to Linux (Ubuntu). I am teaching myself Python + Django.
GOAL: I want to setup a local development environment where I can build a django application and run it locally before deploying it live online.
SO FAR: Python comes installed with Linux. Gedit does also. Ok great. After that I am lost.
I am not sure how to proceed. I am a total Linux noob. I am guessing I need apache running, mysql running, and django to run. I don't know how to setup these things to run or how to set the proper directories or what I need to link to what... really I am not even sure what the right questions are to ask.
Quick answer:
Just install django via their documentation, and you will not even need apache running as it will run its own server. You can use sqlite as a db and you won't even have to worry about mysql. This is if your goal is to learn django and get things running asap.
Otherwise, if you want to take the full route, you'll need to start learning a lot more (which isn't a bad thing). I'd say take a look at some of the slicehost guides for setting up apache, mysql in ubuntu:
http://articles.slicehost.com/2010/5/19/installing-apache-on-ubuntu
http://articles.slicehost.com/2011/3/10/installing-mysql-server-on-ubuntu
And then pick up with just installing django and going from there. The django tutorial is awesome. There's plenty of other documentation out there on the web & tutorials for setting up dev environments.
Assuming you have python
You can install pip:
easy_install pip
From now you can use pip to install your python libraries for example to install django
pip install django
For development I would prefer pydev, it has a support for django with the power of eclipse.

Categories