Django registration-redux migrate not working


#1

Using django 1.9
django-registration-redux==1.3a0
python 2.7

I added ‘registration’ , ‘sites’ to the INSTALELD_APPS and installed django-registration-redux.
INSTALLED_APPS = [
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.sites’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
#third party apps
’crispy_forms’,
‘registration’,
#my apps
’polls’,
]

When I do a python manage.py migrate, I get the following error:
rachanas-mbp:mysite rachana$ python manage.py migrate
Traceback (most recent call last):
File “manage.py”, line 10, in
execute_from_command_line(sys.argv)
File “/Users/rachana/Development/django-trunk/django/core/management/init.py”, line 331, in execute_from_command_line
utility.execute()
File “/Users/rachana/Development/django-trunk/django/core/management/init.py”, line 323, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/Users/rachana/Development/django-trunk/django/core/management/base.py”, line 353, in run_from_argv
self.execute(*args, **cmd_options)
File “/Users/rachana/Development/django-trunk/django/core/management/base.py”, line 404, in execute
output = self.handle(*args, **options)
File “/Users/rachana/Development/django-trunk/django/core/management/commands/migrate.py”, line 86, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File “/Users/rachana/Development/django-trunk/django/db/migrations/executor.py”, line 19, in init
self.loader = MigrationLoader(self.connection)
File “/Users/rachana/Development/django-trunk/django/db/migrations/loader.py”, line 49, in init
self.build_graph()
File “/Users/rachana/Development/django-trunk/django/db/migrations/loader.py”, line 178, in build_graph
self.load_disk()
File “/Users/rachana/Development/django-trunk/django/db/migrations/loader.py”, line 95, in load_disk
for name in os.listdir(directory):
OSError: [Errno 20] Not a directory: ‘/Library/Python/2.7/site-packages/django_registration_redux-1.3a0-py2.7.egg/registration/migrations’


#2

Looks like your project isn’t set up the way that Hello Web App shows you how to set it up. :( The migrations folder should be in your app folder (the one we named “collection” in the tutorial, if you renamed it.)

Also, looks like you’re not in your virtualenv. I should have put a note in the chapter to remind you about making sure to always be “in” the virtual environment when we install. Do you recall making a virtualenv? I can walk you through that if not!


#3

Thanks for your reply.

I do not have a virtualenv. You are right. I just have a directory on my terminal in my Mac. Do I need a virtualenv?
Please let me know how to do that? That would be very helpful.


#4

Follow the instructions here for installing virtualenv:

Then start the virtualenv in your folder like in here:

You’ll need to install Django again — if you think of virtualenv as a bubble around your project, as we’re making a new bubble we need to install the right things again. :)

Make sure you have (venv) in front of your command line (as shown in the Github instructions I linked) whenever you’re working on your project. You can enter the environment by typing source /venv/bin/activate when you want to go “into” the environment (make sure to type this in your top level project folder, so the one with manage.py) and you can leave it by typing deactivate. You need to be in it though for Django commands (like python manage.py runserver to start your server) to work.

Then you can try installing django-registration-redux. Let me know if the above worked!


#5

I will try that out. Thank you so much. I am new to django and python, but I am loving it so far.
I appreciate your help.
Do you know if django 1.8 is better or django 1.9 ? I know django 1.8 is stable, but if I am starting now, what would be a good version to start with. I don’t want to deal with a lot of bugs in an unstable release.


#6

Django 1.8 — I can’t guarantee that everything I use in Hello Web App works in 1.9 just yet. For example, HWA was originally written for 1.7 and 1.8 changed the way that URLpatterns are written. I am not 100% sure of the changes 1.9 will make so definitely 1.8 for now. :)


#7

Hi llmedaring :)
I have a problem almost same as rachana193 problem.

when i create virtual env folder and start django project and then add django registration to installed apps, and then run manage.py …# every thing work perfect …! BUT when i start django project in pycharm and add django-registration configration to the project and run manage.py migrate, so i get this problem :-(

File “/usr/local/lib/python3.4/dist-packages/django/core/management/init.py”, line 338, in execute_from_command_line
utility.execute()
File “/usr/local/lib/python3.4/dist-packages/django/core/management/init.py”, line 312, in execute
django.setup()
File “/usr/local/lib/python3.4/dist-packages/django/init.py”, line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File “/usr/local/lib/python3.4/dist-packages/django/apps/registry.py”, line 108, in populate
app_config.import_models(all_models)
File “/usr/local/lib/python3.4/dist-packages/django/apps/config.py”, line 198, in import_models
self.models_module = import_module(models_module_name)
File “/usr/lib/python3.4/importlib/init.py”, line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 2231, in _gcd_import
File “”, line 2214, in _find_and_load
File “”, line 2203, in _find_and_load_unlocked
File “”, line 1200, in _load_unlocked
File “”, line 1129, in _exec
File “”, line 1448, in exec_module
File “”, line 321, in _call_with_frames_removed
File “/home/amr/PycharmProjects/ScoutSource/registration/models.py”, line 15, in
User = get_user_model()
File “/usr/local/lib/python3.4/dist-packages/django/contrib/auth/init.py”, line 150, in get_user_model
return django_apps.get_model(settings.AUTH_USER_MODEL)
File “/usr/local/lib/python3.4/dist-packages/django/apps/registry.py”, line 199, in get_model
self.check_models_ready()
File “/usr/local/lib/python3.4/dist-packages/django/apps/registry.py”, line 131, in check_models_ready
raise AppRegistryNotReady(“Models aren’t loaded yet.”)
django.core.exceptions.AppRegistryNotReady: Models aren’t loaded yet.


#8

Ooh PyCharm. I wonder if that’s why — I was just introduced to it at DjangoCon and I know it does all it’s configuration and whatnot a bit differently. =/

What version of Django do you have installed?


#9

Also, try the second answer here? The one with 100+ upvotes. http://stackoverflow.com/questions/25537905/django-1-7-throws-django-core-exceptions-appregistrynotready-models-arent-load


#10

version 1.8.4


#11

I don’t know where should i locate
import django
django.setup()

…!?

I hope what I have requested is possible.
Thank you


#12

Sorry, should have mentioned — go into your shell and run it,

Enter your project folder (the one with manage.py):

$ python manage.py shell
( a bunch of stuff )
>>> import django
>>> django.setup()

So, run those two commands from your shell, which allows you to interact with Django and the database in your command line.


#13

Thank you :-)
I Will let you know the result when I come back to my laptop :-)


#14

It worked for me on the virtualenv as Tracy suggested.