Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Unable to run Migrations #34

Open
sbshah97 opened this issue Dec 26, 2017 · 8 comments
Open

Unable to run Migrations #34

sbshah97 opened this issue Dec 26, 2017 · 8 comments

Comments

@sbshah97
Copy link

Hi, I tried setting up the project and set up the virtual environment and activated it as well. However when I try to run migrations I get the following errors.

Traceback (most recent call last):
  File "manage.py", line 13, in <module>
    execute_from_command_line(sys.argv)
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/core/management/__init__.py", line 317, in execute
    settings.INSTALLED_APPS
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/conf/__init__.py", line 106, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/home/salman-bhai/Documents/anaconda36/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/src/appstore/settings/development.py", line 1, in <module>
    from .base import *             # NOQA
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/src/appstore/settings/base.py", line 10, in <module>
    from django.core.urlresolvers import reverse_lazy
ModuleNotFoundError: No module named 'django.core.urlresolvers'

I did try to Google this up and came upon this link

Tried changing the appstore/settings/base.py file from

from django.core.urlresolvers import reverse_lazy

to

from django.urls import reverse_lazy

but got the following error.

Traceback (most recent call last):
  File "manage.py", line 13, in <module>
    execute_from_command_line(sys.argv)
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/core/management/__init__.py", line 216, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/core/management/__init__.py", line 36, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/home/salman-bhai/Documents/anaconda36/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 12, in <module>
    from django.db.migrations.autodetector import MigrationAutodetector
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/db/migrations/autodetector.py", line 11, in <module>
    from django.db.migrations.questioner import MigrationQuestioner
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/db/migrations/questioner.py", line 9, in <module>
    from .loader import MigrationLoader
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/db/migrations/loader.py", line 8, in <module>
    from django.db.migrations.recorder import MigrationRecorder
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 9, in <module>
    class MigrationRecorder:
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 22, in MigrationRecorder
    class Migration(models.Model):
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/db/models/base.py",line 100, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/apps/registry.py", line 244, in get_containing_app_config
    self.check_apps_ready()
  File "/home/salman-bhai/All-Projects/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/apps/registry.py", line 127, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

Let me know how we can solve this error!

@abhijithanilkumar
Copy link
Owner

I'm extremely sorry that I didn't follow up on this. Are you still planning to work on this?

@sbshah97
Copy link
Author

I would love to if you can get me started here! Maybe small contributions once in a while! Is the main repo link here itself or do we have another main repository somewhere else?

@abhijithanilkumar
Copy link
Owner

Hi @salman-bhai, This is the main repository. Sorry for the delay in response 😓 Btw, this error is a virtualenv issue, I think. Once you setup virtualenv, before running migrations, you have to goto src/appstore/settings/ and run cp local.sample.env local.env. I missed this step in the readme, will update it.

@rohit-mp
Copy link

rohit-mp commented Feb 4, 2019

Hi, I did the above steps and fixed the import errors (Django 2.0 related) shown in all the files. Now I'm facing another issue and am still unable to run migrate.

Traceback (most recent call last):
  File "manage.py", line 13, in <module>
    execute_from_command_line(sys.argv)
  File "/home/rohit/ns3/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/rohit/ns3/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
    django.setup()
  File "/home/rohit/ns3/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/rohit/ns3/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
    app_config.import_models()
  File "/home/rohit/ns3/ns-3-AppStore/appstore/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/rohit/ns3/ns-3-AppStore/src/profiles/models.py", line 8, in <module>
    class BaseProfile(models.Model):
  File "/home/rohit/ns3/ns-3-AppStore/src/profiles/models.py", line 10, in BaseProfile
    primary_key=True)
TypeError: __init__() missing 1 required positional argument: 'on_delete'

@abhijithanilkumar
Copy link
Owner

Hi @rohit-mp,
We do not officially support Django 2.0 yet, can you try using a virtualenv with the mentioned requirements and see if it is working?

@rohit-mp
Copy link

rohit-mp commented Feb 7, 2019

I checked again and pip install fails for few tools
Failed to build django-admin-bootstrapped django-authtools easy-thumbnails django-haystack

All of them had the same error as this one below

Running setup.py bdist_wheel for easy-thumbnails ... error
  Complete output from command /home/rohit/ns3/ns-3-AppStore/appstore/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-5l896nre/easy-thumbnails/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpx7b_l05opip-wheel- --python-tag cp36:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help
  
  error: invalid command 'bdist_wheel'
  
  ----------------------------------------
  Failed building wheel for easy-thumbnails
  Running setup.py clean for easy-thumbnails

Running pip install as sudo installed those tools but with a different command:

Running setup.py install for django-admin-bootstrapped ... done
  Running setup.py install for django-authtools ... done
  Running setup.py install for easy-thumbnails ... done
  Running setup.py install for django-haystack ... done
  Running setup.py install for python-openid ... done

I'm not sure what bdist_wheel was doing earlier.
But along with these being installed, it gave another error:

django-haystack 2.6.1 has requirement Django<1.11, but you'll have django 1.11.18 which is incompatible.
django-admin-bootstrapped 2.5.7 has requirement Django<1.9,>=1.8, but you'll have django 1.11.18 which is incompatible.

The Django version mentioned in base.txt is >=1.9 while installing, so I guess the django part needs to be completely updated?

@abhijithanilkumar
Copy link
Owner

Can you confirm whether you are using a virtualenv? Looks like you have multiple django versions in your system, causing an error. Please work with a virtualenv, and run the installation and post any error that you find.

@rohit-mp
Copy link

rohit-mp commented Feb 13, 2019 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants