Skip to content

Instantly share code, notes, and snippets.

@eebbesen
Last active November 3, 2019 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eebbesen/21141d8cc8f46171ab26a59797383d3d to your computer and use it in GitHub Desktop.
Save eebbesen/21141d8cc8f46171ab26a59797383d3d to your computer and use it in GitHub Desktop.
# deleting Pipfile.lock helps me get past `pipenv install --dev`
~/p3/mnpay/server$ rm Pipfile.lock
~/p3/mnpay/server$ python -V
Python 3.7.4
~/p3/mnpay/server$ pipenv --version
pipenv, version 2018.11.26
~/p3/mnpay/server$ pipenv install --dev
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
✔ Success!
Locking [packages] dependencies…
✔ Success!
Updated Pipfile.lock (5f2093)!
Installing dependencies from Pipfile.lock (5f2093)…
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 37/37 — 00:00:06
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
# Error when runnint `python manage.py migrate`
~/p3/mnpay/server$ python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
import django
ModuleNotFoundError: No module named 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 17, in <module>
"Couldn't import Django. Are you sure it's installed and "
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
# When I try to use a virtual environment I get a different error
~/p3/mnpay/server$ pipenv shell
(server) bash-3.2$ python manage.py migrate
Traceback (most recent call last):
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/apps/registry.py", line 155, in get_app_config
return self.app_configs[app_label]
KeyError: 'admin'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/core/management/base.py", line 361, in execute
self.check()
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/core/management/base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 65, in _run_checks
issues.extend(super()._run_checks(**kwargs))
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/core/management/base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/urls/resolvers.py", line 584, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/urls/resolvers.py", line 577, in urlconf_module
return import_module(self.urlconf_name)
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/eebbesen/p3/mnpay/server/config/urls.py", line 22, in <module>
url(r'^admin/', admin.site.urls),
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/utils/functional.py", line 256, in inner
self._setup()
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/contrib/admin/sites.py", line 529, in _setup
AdminSiteClass = import_string(apps.get_app_config('admin').default_site)
File "/Users/eebbesen/.local/share/virtualenvs/server-tHqR4joV/lib/python3.7/site-packages/django/apps/registry.py", line 162, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'admin'.
@eebbesen
Copy link
Author

eebbesen commented Nov 3, 2019

This seems to work ok when I remove the following line from server/config/urls.py

    url(r'^admin/', admin.site.urls),
(server) bash-3.2$ python manage.py migrate
Operations to perform:
  Apply all migrations: auth, contenttypes, sessions, wages
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0001_initial... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying sessions.0001_initial... OK
  Applying wages.0001_initial... OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment