Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating a Django project from 1.2 to 1.3, manage.py not working properly

Tags:

python

django

I decided I wanted to update my Django 1.2 project to Django 1.3 to take advantage of the new static files mechanisms. I deleted my old version of Django, and followed the documentation's instructions for installing the development version from svn.

The changes seem to have taken. That is, python -c "import django; print django.get_version()" yields "1.3 alpha 1 SVN-14686". Yet, I can't seem to take advantage of 1.3 features in my old project. If I do "python manage.py collectstatic --help" I get "Unknown command: 'collectstatic'".

I tried creating a fresh project and doing the same thing, and the collectstatic command worked. I dug into django.core.management, but can't really make a lot of sense of it. The docstring for get_commands() mentions:

The dictionary is cached on the first call and reused on subsequent calls.

Maybe this is totally irrelevant, but I wonder if my problem has something to do with caching (that is, an old version of the command dictionary is cached, which doesn't have the new 1.3 commands?). Any thoughts?

like image 429
Coquelicot Avatar asked Nov 23 '10 19:11

Coquelicot


People also ask

Why does Python manage py Runserver not work?

The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to load any pages, check your computer's network connection. If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

How do I choose Django version?

Go to Settings -> Project Interpreter . Double-click the Django package. Activate the check box Specify version and select the version you want.

What is the work of manage py in Django?

It is your tool for executing many Django-specific tasks -- starting a new app within a project, running the development server, running your tests... It is also an extension point where you can access custom commands you write yourself that are specific to your apps.


1 Answers

In order to use a management command, you need to add the application that provides it to INSTALLED_APPS in settings.py. From the docs:

First, you’ll need to make sure that django.contrib.staticfiles is in your INSTALLED_APPS.

That should make the command available.

like image 135
Daniel Roseman Avatar answered Sep 23 '22 09:09

Daniel Roseman