Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError after typing "./migrate.py migrate" with Static project/Python 3.6/Django 1.11.7 #55

Open
roperi opened this issue Dec 29, 2017 · 2 comments

Comments

@roperi
Copy link

roperi commented Dec 29, 2017

$ ./manage.py migrate
Traceback (most recent call last):
  File "./manage.py", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/core/management/base.py", line 327, in execute
    self.check()
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 62, in _run_checks
    issues.extend(super(Command, self)._run_checks(**kwargs))
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/core/checks/urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/core/checks/urls.py", line 26, in check_resolver
    return check_method()
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/urls/resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/home/user/.virtualenvs/pinax_test/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/user/Desktop/workspace/pinax_test/mystatic/mystatic/urls.py", line 5, in <module>
    url(r"^(.*)$", "mystatic.views.static_view"),
  File "/home/user/.virtualenvs/pinax_test/lib/python3.6/site-packages/django/conf/urls/__init__.py", line 85, in url
    raise TypeError('view must be a callable or a list/tuple in the case of include().')
TypeError: view must be a callable or a list/tuple in the case of include().
@roperi
Copy link
Author

roperi commented Dec 29, 2017

Forgot to say I'm referring to a fresh install using Pinax starter projects.

So this is what I typed before getting the error:

pip install pinax-cli
pinax start  static mystatic
cd mystatic
pip install -r requirements.txt
./manage.py migrate
...

@roperi roperi changed the title TypeError after typing "./migrate.py migrate" with Python 3.6/Django 1.11.7 TypeError after typing "./migrate.py migrate" with Static project/Python 3.6/Django 1.11.7 Dec 29, 2017
@KatherineMichel
Copy link
Member

Hello @h-2-0, I just submitted a patch #70 to hopefully fix this issue. Sorry for the delay. This is what worked for me.

I believe Django >= 2 should be

from django.urls import path
from mystatic import views

urlpatterns = [
    path("<str:path>", views.static_view),
]

I believe Django < 2 should be

from django.conf.urls import url
from mystatic import views


urlpatterns = [
    url(r"^(.*)$", views.static_view),
]

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

No branches or pull requests

2 participants