Django installer error

I'm installing Django and it fails with the following:

Now installing Django version 1.2.4 ..
  Database initialization failed at yes.no :
  Error: Your action, 'syncdb', was invalid.

This results in a partially installed Django. Didn't find resolution in a search. Before ever using the installer, I installed an older version of Django manually (0.91.3). My guess is that the previously installed version may be interfering -- if possible I'd like to install the new version without uninstalling the old manually-installed version first, although I would remove it if necessary.

Any other thoughts?

Status: 
Active

Comments

Are you using a MySQL database with Django, or PostgreSQL?

Also, which Python version are you using?

PostgreSQL v 8.1.22

Python v 2.4.3

I think it was the old version of Django interfering -- after removing it I no longer see that error (now I'm on a different error).

Ok .. what is the new error?

Unrelated issue with my db config. I'll continue working on this, thanks for your help!

Actually, it looks like the installer is ignoring the login credentials I enter in the install options, instead using the default account login even though I've given it a different login. The default account login contains symbols like a numeral, which apparently won't let Django initialize the db. Thoughts?

Can you check if the account creation works if you just choose an alphabetic login and password?

It doesn't. So now there are two issues:

1) Django installer ignores specified login info and always uses domain login info.

2) Django setup fails. The settings file has a syntax error, seems like it puts two sets of single quotes around the password string, maybe it should only have one. Here's the output:

Now installing Django version 1.2.4 ..

  Database initialization failed at yes.no :

  Traceback (most recent call last):
    File "manage.py", line 4, in ?
      import settings # Assumed to be in the same directory.
    File "/<location>/settings.py", line 17
      'PASSWORD': ''<password>'',
                                     ^
  SyntaxError: invalid syntax

I'm going to have to try re-producing this problem myself ... which Linux distribution and version are you running there?

CentOS Linux 5.5

Virtualmin 3.83 Pro

Ok .. and is this a totally fresh Django install, or an upgrade?

Also, are you using the Python version that comes with CentOS 5.5?

Fresh Django install.

Distro Python, version 2.4.3.

So I just did an install of Django using Virtualmin on a completely fresh CentOS 5.5 system with all packages up to date, and it worked fine..

I think I would need to login to your system myself to debug this further..

It looks like the install script places single quotes around the password, and on my system the password already comes with single quotes. The resulting duplicates cause an error. I edited the install script to get it running here; you may want to work on a more generalized solution to account for different system setups. You may also want to look into the issue with the install script ignoring specified login credentials.

What was your change to the django installer exactly? From looking at the code, I don't see any place where it quotes the password at all ..

# diff django.pl django.pl.orig 
265c265
<            $l = "        'PASSWORD': $dbpass,";
---
>            $l = "        'PASSWORD': '$dbpass',";

The installer seems to place django within the user home dir, so commands aren't found. e.g.:

# python manage.py 
Traceback (most recent call last):
  File "manage.py", line 2, in ?
    from django.core.management import execute_manager
ImportError: No module named django.core.management

Adding the parent dir to pythonpath hasn't helped. Thoughts?

Ok, thanks .. I actually already fixed that quoting issue, but it hasn't been released yet. The fix will be in Virtualmin 3.84.

As for the other error, make sure you set PYTHONPATH to /home/domain.com/public_html/lib/python

As for the other error, make sure you set PYTHONPATH to /home/domain.com/public_html/lib/python

Already did, still doesn't work.

I just tested this, and it worked fine for me.. make sure you set PYTHONPATH like so :

export PYTHONPATH=/home/domain.com/public_html/lib/python

This assumes that Django wasn't installed into a sub-directory under public_html.

When I manually export PYTHONPATH it gets added, but for some reason this dir does not seem to work in my /etc/profile PYTHONPATH. Symlinking django from site-packages seems to work in the immediate sense...

Paths in /etc/profile might not get applied until you login and logout, or perhaps even reboot..

I'd tried logging back in and rebooting, to no effect...

After a few more solved issues, I'm now getting a "No module named extensions" error. When I install django-extensions I get a syntax error, although it looks at least partially installed. Thoughts?

Once the initial hurdles are over I'm sure things'll quiet down again!

At this point, I think you may need to talk to Django experts ... Virtualmin just sets up a very basic development environment, after which you are on your own for creation of the rest of the app.

I still see the quoting error in Virtualmin 3.85, and also the install script still ignores manually entered passwords.

So even for a new install of django, the PASSWORD line in the config file still isn't quoted properly?

I looked at the installer code, and it is definitely putting quotes on that line..

Even for a completely new install of Django on a completely new virtual server, the installer sends an invalidly formatted password that causes the install to fail.

As mentioned above, the problem is that it's putting too many quotes.

Also, it still ignores user-specified passwords. Incidentally, for PostgreSQL installs it seems to use the "postgresql" backend rather than "postgresql_psycopg2", which at least once the Django people publicly recommended.

So when you created this domain, did you actually enter a password that has single quotes in it?

Because Virtualmin shouldn't be adding any extra quotes, other than those that happened to be in the password ..

There are no quotes in the password itself. When the install script gets the domain password to use for Django, it gets the password itself enclosed in a pair of single quotes. The install script then adds another pair of single quotes.

The extra pair of single quotes cause the install to fail.

Those additional quotes in the password are very surprising, as Virtualmin doesn't add extra quotes when putting the DB password in the django config.

Can you check if Virtualmin is somehow already storing extra quotes for the password? You can do this as follows :

  1. Get the domain's unique ID with the command virtualmin list-domains --domain yourdomain.com --id-only
  2. Run the command grep pass /etc/webmin/virtual-server/domains/$ID , where $ID is the unique ID from step 1.

No quotes in the domain password stored there.

The only method I can think of the debug this further currently would be to actually login to your system myself and try a django install into the same domain, and see what is happening with the password ... let me know if that is possible.