django-1.7

Django: AppRegistryNotReady()

假如想象 提交于 2019-11-27 03:49:48
Python: 2.7; Django: 1.7; Mac 10.9.4 I'm following the tutorial of Tango with Django At Chapter 5, the tutorial teaches how to create a population script, which can automatically create some data for the database for the ease of development. I created a populate_rango.py at the same level of manage.py. Here's the populate_rango.py: import os def populate(): python_cat = add_cat('Python') add_page( cat=python_cat, title="Official Python Tutorial", url="http://docs.python.org/2/tutorial/" ) add_page( cat=python_cat, title="How to Think like a Computer Scientist", url="http://www.greenteapress

How to simplify migrations in Django 1.7?

痴心易碎 提交于 2019-11-27 02:55:23
There are already similar questions for South, but I have started my project with Django 1.7 and am not using South. During development a lot of migrations have been created, however the software is not yet delievered and there exists no database that must be migrated. Therefore I would like to reset the migrations as if my current model was the original one and recreate all databases. What is the recommended way to do that? EDIT: As of Django 1.8 there is a new command named squashmigrations which more or less solves the problem described here. kzorro I got this. I just figured this out and

Creating Partial Indexes with Django 1.7

≯℡__Kan透↙ 提交于 2019-11-26 23:14:54
问题 The documentation for Django 1.7 mentions RunSQL classes can be used to create partial indexes on your tables. I have a table where I want the combination of title , blog & category to be unique. However if category is not provided, the combination of title & blog should still be unique. class Post(models.Model): title = models.CharField(max_length=200) blog = models.ForeignKey(Blog) category = models.ForeignKey(Category, null=True, blank=True) I can achieve this constraint with partial

Django 1.7 - makemigrations not detecting changes

空扰寡人 提交于 2019-11-26 21:42:48
As the title says, I can't seem to get migrations working. The app was originally under 1.6, so I understand that migrations won't be there initially, and indeed if I run python manage.py migrate I get: Operations to perform: Synchronize unmigrated apps: myapp Apply all migrations: admin, contenttypes, auth, sessions Synchronizing apps without migrations: Creating tables... Installing custom SQL... Installing indexes... Running migrations: No migrations to apply. If I make a change to any models in myapp , it still says unmigrated, as expected. But if I run python manage.py makemigrations

How to resolve “django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: foo” in Django 1.7?

心不动则不痛 提交于 2019-11-26 18:51:36
On upgrading to Django 1.7 I'm getting the following error message from ./manage.py $ ./manage.py Traceback (most recent call last): File "./manage.py", line 16, in <module> execute_from_command_line(sys.argv) File "/home/johnc/.virtualenvs/myproj-django1.7/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 427, in execute_from_command_line utility.execute() File "/home/johnc/.virtualenvs/myproj-django1.7/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 391, in execute django.setup() File "/home/johnc/.virtualenvs/myproj-django1.7/local/lib

Django 1.7 upgrade error: AppRegistryNotReady: Models aren't loaded yet

a 夏天 提交于 2019-11-26 18:19:14
问题 I am trying to upgrade a project from Django 1.6 to 1.7. So far, I have created a new virtualenv with all the same installs and upgraded the Django version to the new release. I need to upgrade from South, but had errors doing so, so I thought I'll initially just try runserver, and I get the following error: Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/Users/Name/.virtualenvs/test17/lib/python2.7/site-packages/django/core

Django: AppRegistryNotReady()

早过忘川 提交于 2019-11-26 10:56:24
问题 Python: 2.7; Django: 1.7; Mac 10.9.4 I\'m following the tutorial of Tango with Django At Chapter 5, the tutorial teaches how to create a population script, which can automatically create some data for the database for the ease of development. I created a populate_rango.py at the same level of manage.py. Here\'s the populate_rango.py: import os def populate(): python_cat = add_cat(\'Python\') add_page( cat=python_cat, title=\"Official Python Tutorial\", url=\"http://docs.python.org/2/tutorial/

How to resolve “django.core.exceptions.ImproperlyConfigured: Application labels aren&#39;t unique, duplicates: foo” in Django 1.7?

跟風遠走 提交于 2019-11-26 06:37:05
问题 On upgrading to Django 1.7 I\'m getting the following error message from ./manage.py $ ./manage.py Traceback (most recent call last): File \"./manage.py\", line 16, in <module> execute_from_command_line(sys.argv) File \"/home/johnc/.virtualenvs/myproj-django1.7/local/lib/python2.7/site-packages/django/core/management/__init__.py\", line 427, in execute_from_command_line utility.execute() File \"/home/johnc/.virtualenvs/myproj-django1.7/local/lib/python2.7/site-packages/django/core/management/