allo- / ffprofile

A tool to create firefox profiles with personalized defaults.
GNU Affero General Public License v3.0
769 stars 56 forks source link

From "django>=1.8,<1.9" to "Django==3.0.4" installation #203

Closed Starli0n closed 3 years ago

Starli0n commented 3 years ago

Hi,

I faced on issue while trying to run my own server in order to potentially make some contributions.

Indeed, the file INSTALL.md indicate a version of Django ("django>=1.8,<1.9") which seems to be outdated compare to the version from the requirements.txt file ("Django==3.0.4").

I tried to adapt the explanations for the project\urls.py file and I have this code:

from django.contrib import admin
from django.urls import path
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from profilemaker import urls

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', urls),
]
urlpatterns += staticfiles_urlpatterns()

But then I have an error, while trying to run the server:

[venv] λ ./manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/utils/autoreload.py", line 53, in wrapper
    fn(*args, **kwargs)
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
    self.check(display_num_errors=True)
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/core/management/base.py", line 392, in check
    all_issues = self._run_checks(
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/core/management/base.py", line 382, in _run_checks
    return checks.run_checks(**kwargs)
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 407, in check
    for pattern in self.url_patterns:
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 588, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 581, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/project/project/urls.py", line 23, in <module>
    path('', urls),
  File "/mnt/c/Users/Starli0n/Develop/src/github.com/allo-/firefox-profilemaker/venv/lib/python3.8/site-packages/django/urls/conf.py", line 73, in _path
    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().

Could you please help me on that ?


By the way, you project is a fantastic one :+1:

allo- commented 3 years ago

try

from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

urlpatterns = [
    url(r'', include("profilemaker.urls")),
]
urlpatterns += staticfiles_urlpatterns()

This should work with 3.0.4

I think quite a few urlconfig things changed and youre probably getting one of the, wrong. You don't need an admin include as the project currently does not use the database at all. When you get it to run with current Django, feel free to send a pull request. Probably there is not much to be changed, but it needs to be tested.

Starli0n commented 3 years ago

Thank you, it works :+1:

I am preparing a pull request 😄

allo- commented 3 years ago

Documentation fixed in pull request #204.