You are not logged in.

#1 2007-01-14 11:51:45

remi
Member
From: London
Registered: 2006-09-19
Posts: 741
Website

Running the latest Django trunk

Some people want to run the latest Django trunk.
To do so, all you have to do is delete $HOME/lib/python2.4/django and replace it with the latest Django trunk.
Restart your Apache instance and voila smile


Code:

[a12007@web6 ~]$ cd lib/python2.4/
[a12007@web6 python2.4]$ ls
django
[a12007@web6 python2.4]$ rm -fr django
[a12007@web6 python2.4]$ svn checkout http://code.djangoproject.com/svn/django/trunk/django/
[...]
A    django/middleware/doc.py
A    django/middleware/transaction.py
 U   django
Checked out revision 4313.
[a12007@web6 python2.4]$ cd
[a12007@web6 ~]$ cd webapps/django/apache2/bin
[a12007@web6 bin]$ ./restart
Restarted
[a12007@web6 bin]$

Cheers,

Remi.


WebFaction - Smarter web hosting

Offline

 

#2 2007-03-19 22:12:32

hhodges
Member
Registered: 2007-02-20
Posts: 18

Re: Running the latest Django trunk

I already have django 0.95 running, and I'd like to keep it running that way for one site. But, I'd also like to run the development version for second site. How would I do that? Would I wind up with a django and djangoD? or something like that?

Offline

 

#3 2007-03-19 23:40:44

IAIHMB
Member
From: Hudson, Florida.
Registered: 2006-09-19
Posts: 1362

Re: Running the latest Django trunk

I would create a second application of type Django and checkout the desired revision of Django in the application's directory. If you take this approach don't forget to remove /(Home Directory)/(Username)/lib/python2.4/ from the Python path in your httpd.conf.

Last edited by IAIHMB (2007-03-20 18:59:24)


-David Sissitka

Offline

 

#4 2007-03-20 18:53:22

hhodges
Member
Registered: 2007-02-20
Posts: 18

Re: Running the latest Django trunk

Thanks dave.

I'm rather new to python and got lost on the path part. I'm also assuming you meant the httpd.conf and not .htaccess. The path settings in httpd.conf look like this:

    PythonPath "['/home2/starledger/webapps/dj_dev_tvj'] + sys.path"

Myproject is running, but I'm not sure if it's using the right version of Django.

I've been following this tutorial: http://forum.webfaction.com/viewtopic.php?id=27 and I'm wondering if this conflicts with the other setting:

>> export DJANGO_SETTINGS_MODULE=mysite.settings
>> export PYTHONPATH=$PWD

Thanks again,  and any help would be appreciated.

Offline

 

#5 2007-03-20 19:57:12

IAIHMB
Member
From: Hudson, Florida.
Registered: 2006-09-19
Posts: 1362

Re: Running the latest Django trunk

You're right, I got .htaccess and httpd.conf confused. By default your Python path will look something like:

Code:

-bash-3.00$ python2.4
Python 2.4.3 (#1, Jul 18 2006, 09:58:38)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sys import path
>>> path
['', '/home2/starledger/lib/python2.4', '/usr/local/lib/python2.4/site-packages/setuptools-0.6b4-py2.4.egg', '/usr/local/lib/python24.zip', '/usr/local/lib/python2.4', '/usr/local/lib/python2.4/plat-linux2', '/usr/local/lib/python2.4/lib-tk', '/usr/local/lib/python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages', '/usr/local/lib/python2.4/site-packages/PIL']

Since you don't want to use Django from /home2/starledger/lib/python2.4 you'll want to remove it from your Python path. Assuming the Django that you want to use is located at /home2/starledger/webapps/dj_dev_tvj/django your Python path would be:

Code:

['', '/home2/starledger/webapps/dj_dev_tvj', '/usr/local/lib/python2.4/site-packages/setuptools-0.6b4-py2.4.egg', '/usr/local/lib/python24.zip', '/usr/local/lib/python2.4', '/usr/local/lib/python2.4/plat-linux2', '/usr/local/lib/python2.4/lib-tk', '/usr/local/lib/python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages', '/usr/local/lib/python2.4/site-packages/PIL']

Which would look something like this in httpd.conf:

Code:

PythonPath "['', '/home2/starledger/webapps/dj_dev_tvj', '/usr/local/lib/python2.4/site-packages/setuptools-0.6b4-py2.4.egg', '/usr/local/lib/python24.zip', '/usr/local/lib/python2.4', '/usr/local/lib/python2.4/plat-linux2', '/usr/local/lib/python2.4/lib-tk', '/usr/local/lib/python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages', '/usr/local/lib/python2.4/site-packages/PIL']"

You can check which version of Django you're using with:

Code:

-bash-3.00$ python2.4
Python 2.4.3 (#1, Jul 18 2006, 09:58:38)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(0, 96, 'pre')

Don't forget to update your Python path when in the interactive session or you'll get the version of Django from /home2/starledger/lib/python2.4. With that said it might be easier to upgrade your existing Django project to work with the version of Django that you'd like to use.

Last edited by IAIHMB (2007-03-20 19:58:05)


-David Sissitka

Offline

 

#6 2007-03-22 13:25:45

schalker
Member
Registered: 2007-03-22
Posts: 3

Re: Running the latest Django trunk

This may be a stupid question to the original post, but when I replace the current version with the lates django trunk, I also have to update at least the 5 Python files in the bin-directory, right? (django-admin.py etc.).

Or better, make a link to the file in the trunk.

Offline

 

#7 2007-03-22 14:58:29

remi
Member
From: London
Registered: 2006-09-19
Posts: 741
Website

Re: Running the latest Django trunk

schalker wrote:

This may be a stupid question to the original post, but when I replace the current version with the lates django trunk, I also have to update at least the 5 Python files in the bin-directory, right? (django-admin.py etc.).

Or better, make a link to the file in the trunk.

Yes you do. But these files don't change as often as the other files.

Cheers,

Remi.


WebFaction - Smarter web hosting

Offline

 

#8 2007-03-22 16:06:35

voila
Member
Registered: 2007-03-22
Posts: 3

Re: Running the latest Django trunk

Hi,

I just wanted say that I just did the update to the django trunk and I'm getting this on my site now:

Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/local/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
    result = object(req)

  File "/home2/mazus/lib/python2.4/django/core/handlers/modpython.py", line 177, in handler
    return ModPythonHandler()(req)

  File "/home2/mazus/lib/python2.4/django/core/handlers/modpython.py", line 145, in __call__
    self.load_middleware()

  File "/home2/mazus/lib/python2.4/django/core/handlers/base.py", line 31, in load_middleware
    raise exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"' % (mw_module, e)

ImproperlyConfigured: Error importing middleware django.contrib.sessions.middleware: "MySQLdb-1.2.1p2 or newer is required; you have 1.2.1"


I'm about to go see if I can install the newer MySQLdb module but I thought someone might find this useful. Please let me know if there is an easy way around this that I'm not seeing. Thanks.

Offline

 

#9 2007-03-22 17:46:37

mboersma
Member
From: Boulder, Colorado USA
Registered: 2006-10-21
Posts: 7
Website

Re: Running the latest Django trunk

You might try replacing this line:
DATABASE_ENGINE = 'mysql'
with this:
DATABASE_ENGINE = 'old_mysql'

From what I've seen on the django-dev list, they needed to ensure that the MySQLdb driver was a certain version, but actually determining that can be problematic.  Right now in trunk they simply copied the earlier mysql backend code to "old_mysql" to provide a workaround for exactly the problem you're having.

Either that or ensure that you have MySQLdb-1.2.1p2 or later as your driver.

Offline

 

#10 2007-03-22 21:44:11

voila
Member
Registered: 2007-03-22
Posts: 3

Re: Running the latest Django trunk

Thanks mboersma. It sounds like that would have sorted it. Remi actually went ahead and upgraded the driver for me which fixed it for me. Very useful info though,thanks!

Offline

 

#11 2007-09-05 22:27:46

kylefox
Member
From: Edmonton
Registered: 2007-03-07
Posts: 24

Re: Running the latest Django trunk

When I'm creating a new app in the control panel, and I want to use Django's trunk, what App Type should I select?

Offline

 

#12 2007-09-05 22:32:51

IAIHMB
Member
From: Hudson, Florida.
Registered: 2006-09-19
Posts: 1362

Re: Running the latest Django trunk

I'd select the newest application of type Django (That is, the one which installs the neweset version of Django.) which uses the desired version of Python.


-David Sissitka

Offline

 

#13 2007-09-05 23:25:33

kylefox
Member
From: Edmonton
Registered: 2007-03-07
Posts: 24

Re: Running the latest Django trunk

Right.  Looks like it should work.

Offline

 

#14 2008-02-01 02:11:28

davemerwin
Member
Registered: 2008-02-01
Posts: 10

Re: Running the latest Django trunk

I have installed trunk as directed when  try to access django from the python shell I am being told that the module doesn't exist. Everything else I have installed in that python dir is showing up with I import from the shell. It is just django giving me problems. Any ideas?

Offline

 

#15 2008-02-01 16:04:16

tworking
Member
Registered: 2008-02-01
Posts: 43

Re: Running the latest Django trunk

davemerwin wrote:

I have installed trunk as directed when  try to access django from the python shell I am being told that the module doesn't exist. Everything else I have installed in that python dir is showing up with I import from the shell. It is just django giving me problems. Any ideas?

If you cd into lib/python2.5 then import it should work.

Offline

 

#16 2008-02-01 21:35:21

IAIHMB
Member
From: Hudson, Florida.
Registered: 2006-09-19
Posts: 1362

Re: Running the latest Django trunk

davemerwin: What commands are you executing and what errors are you getting? I imagine that you're using the wrong version of Python. If you installed Django for Python 2.5 make sure you execute "python2.5" instead of "python".


-David Sissitka

Offline

 

#17 2008-02-01 23:06:07

davemerwin
Member
Registered: 2008-02-01
Posts: 10

Re: Running the latest Django trunk

I installed trunk into python2.4. I installed other modules there as well. They all work, including satchmo when I simply do the following:

$ python
>> import satchmo
>>

However when I do teh following: I get:

>> import django
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named django
>>>

Not sure why I would use 2.5 over 2.4. Every other environment I use is 2.4 and it seems that the command python is aliased to 2.4.

Any ideas?

Lemme know.

Thanks for your time.

Offline

 

#18 2008-02-03 06:26:57

davemerwin
Member
Registered: 2008-02-01
Posts: 10

Re: Running the latest Django trunk

I figured it out. I had checked out svn trunk not svn django. When entering this:

http://code.djangoproject.com/svn/django/trunk/ You get ALL the files including docs and examples. What you want is http://code.djangoproject.com/svn/django/trunk/django

That grabs JUST the django app. Much better and now everything plays well.

Thanks.

Dave

Offline

 

#19 2008-02-25 16:56:01

tworking
Member
Registered: 2008-02-01
Posts: 43

Re: Running the latest Django trunk

schalker wrote:

This may be a stupid question to the original post, but when I replace the current version with the lates django trunk, I also have to update at least the 5 Python files in the bin-directory, right? (django-admin.py etc.).

Or better, make a link to the file in the trunk.

man ln wrote:

ln - make links between files

SYNOPSIS
       ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)
       ln [OPTION]... TARGET                  (2nd form)
       ln [OPTION]... TARGET... DIRECTORY     (3rd form)
       ln [OPTION]... -t DIRECTORY TARGET...  (4th form)

DESCRIPTION
       In  the  1st form, create a link to TARGET with the name LINK_NAME.  In
       the 2nd form, create a link to TARGET in the current directory.  In the
       3rd  and  4th  forms, create links to each TARGET in DIRECTORY.  Create
       hard links by default, symbolic links with --symbolic.   When  creating
       hard links, each TARGET must exist.

Mmmm, that went in one ear and came out the other smile How would I create symlinks to these files? Can you symlink dir to dir? I'm a linux newb so be gentle smile

Offline

 

#20 2008-02-25 17:32:35

davemerwin
Member
Registered: 2008-02-01
Posts: 10

Re: Running the latest Django trunk

I didn't make any changes to the bin files and everything works great. Hmmm...

Offline

 

#21 2008-02-25 18:02:58

IAIHMB
Member
From: Hudson, Florida.
Registered: 2006-09-19
Posts: 1362

Re: Running the latest Django trunk

I've never replaced Django's ~/bin/ stuff when upgrading Django and I've never had any problems. If I'd ever problems with django-admin.py replacing it with the django-admin.py that comes with the version of Django that I'm using would be the first thing that I'd do though. smile


-David Sissitka

Offline

 

#22 2008-02-25 19:41:50

davemerwin
Member
Registered: 2008-02-01
Posts: 10

Re: Running the latest Django trunk

@tworking Remember, your application type allows you to pick your version of python. So, if you update 0.9.6 in Python2.4 but create your app in Python2.5 nothing will work. Make sense?

Offline

 

#23 2008-03-16 18:19:59

seanf
Administrator
Registered: 2008-02-02
Posts: 1899
Website

Re: Running the latest Django trunk

Updated instructions are now in the KB:
https://help.webfaction.com/index.php?_ … p;nav=0,24

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson