numbas / editor

An editor for the Numbas e-learning system.
http://numbas.mathcentre.ac.uk
Apache License 2.0
59 stars 62 forks source link

Failed after install on MAC #495

Closed davidhadas closed 4 years ago

davidhadas commented 4 years ago

I followed: https://docs.numbas.org.uk/en/latest/server-installation/mac-local.html

First error I noticed is when trying to press login after the server was running

Here is the numbas/settings.py (I added .txt to be able to upload here) settings.py.txt

Here is the CLI:

(numbas_venv) Davids-MBP-2:numbas_editor davidh$ python manage.py runserver Watching for file changes with StatReloader Performing system checks...

System check identified no issues (0 silenced). April 16, 2020 - 17:52:06 Django version 2.2.10, using settings 'numbas.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C. [16/Apr/2020 17:52:27] "GET / HTTP/1.1" 200 6793 [16/Apr/2020 17:52:28] "GET /static/source-sans-pro/source-sans-pro.css HTTP/1.1" 200 5718 [16/Apr/2020 17:52:28] "GET /static/css/jquery.noty.css HTTP/1.1" 200 2116 [16/Apr/2020 17:52:28] "GET /static/css/noty_theme_twitter.css HTTP/1.1" 200 3552 [16/Apr/2020 17:52:28] "GET /static/css/jquery-ui.css HTTP/1.1" 200 19370 [16/Apr/2020 17:52:28] "GET /static/bootstrap/css/bootstrap.min.css HTTP/1.1" 200 122079 [16/Apr/2020 17:52:28] "GET /static/css/main.css HTTP/1.1" 200 2314 [16/Apr/2020 17:52:28] "GET /static/images/numbas_logo.png HTTP/1.1" 200 4186 [16/Apr/2020 17:52:28] "GET /static/js/jquery.js HTTP/1.1" 200 85578 [16/Apr/2020 17:52:28] "GET /static/bootstrap/js/bootstrap.min.js HTTP/1.1" 200 36970 [16/Apr/2020 17:52:28] "GET /static/js/jquery.oembed.js HTTP/1.1" 200 51999 [16/Apr/2020 17:52:28] "GET /static/js/knockout.js HTTP/1.1" 200 59822 [16/Apr/2020 17:52:28] "GET /static/js/jquery.noty.js HTTP/1.1" 200 7947 [16/Apr/2020 17:52:28] "GET /static/js/jquery-ui.min.js HTTP/1.1" 200 240427 [16/Apr/2020 17:52:28] "GET /static/js/moment.js HTTP/1.1" 200 34738 [16/Apr/2020 17:52:28] "GET /static/js/mousetrap.min.js HTTP/1.1" 200 3156 [16/Apr/2020 17:52:28] "GET /static/js/es5-shim.js HTTP/1.1" 200 8286 [16/Apr/2020 17:52:28] "GET /static/js/main.js HTTP/1.1" 200 8393 [16/Apr/2020 17:52:28] "GET /static/js/index.js HTTP/1.1" 200 345 [16/Apr/2020 17:52:28] "GET /static/js/editor.js HTTP/1.1" 200 85315 [16/Apr/2020 17:52:28] "GET /static/js/es6-shim.js HTTP/1.1" 200 55994 [16/Apr/2020 17:52:28] "GET /static/bootstrap/fonts/glyphicons-halflings-regular.woff2 HTTP/1.1" 200 18028 [16/Apr/2020 17:52:28] "GET /static/source-sans-pro/WOFF2/TTF/SourceSansPro-Light.ttf.woff2 HTTP/1.1" 200 86336 [16/Apr/2020 17:52:28] "GET /static/source-sans-pro/WOFF2/TTF/SourceSansPro-Regular.ttf.woff2 HTTP/1.1" 200 86844 [16/Apr/2020 17:52:28] "GET /static/source-sans-pro/WOFF2/TTF/SourceSansPro-Bold.ttf.woff2 HTTP/1.1" 200 85604 [16/Apr/2020 17:52:28] "GET /static/icon.png HTTP/1.1" 200 14241 Internal Server Error: /login/ Traceback (most recent call last): File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/contrib/sites/models.py", line 39, in _get_site_by_request SITE_CACHE[host] = self.get(domain__iexact=host) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/db/models/query.py", line 408, in get self.model._meta.object_name django.contrib.sites.models.Site.DoesNotExist: Site matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, *kwargs) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/utils/decorators.py", line 45, in _wrapper return bound_method(args, kwargs) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper return view(request, *args, kwargs) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/utils/decorators.py", line 45, in _wrapper return bound_method(*args, *kwargs) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/utils/decorators.py", line 142, in _wrapped_view response = view_func(request, args, kwargs) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/utils/decorators.py", line 45, in _wrapper return bound_method(*args, kwargs) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func response = view_func(request, *args, *kwargs) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/contrib/auth/views.py", line 61, in dispatch return super().dispatch(request, args, kwargs) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/views/generic/base.py", line 97, in dispatch return handler(request, *args, *kwargs) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/views/generic/edit.py", line 133, in get return self.render_to_response(self.get_context_data()) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/contrib/auth/views.py", line 95, in get_context_data current_site = get_current_site(self.request) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/contrib/sites/shortcuts.py", line 13, in get_current_site return Site.objects.get_current(request) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/contrib/sites/models.py", line 60, in get_current return self._get_site_by_request(request) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/contrib/sites/models.py", line 45, in _get_site_by_request SITE_CACHE[domain] = self.get(domain__iexact=domain) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(args, **kwargs) File "/Users/davidh/numbas_venv/lib/python3.7/site-packages/django/db/models/query.py", line 408, in get self.model._meta.object_name django.contrib.sites.models.Site.DoesNotExist: Site matching query does not exist. [16/Apr/2020 17:52:32] "GET /login/ HTTP/1.1" 500 144840 Not Found: /favicon.ico [16/Apr/2020 17:52:32] "GET /favicon.ico HTTP/1.1" 404 23965

christianp commented 4 years ago

This is an awkward Django problem. What's the value of SITE_ID in numbas/settings.py?

It should match the ID of the Site object in the database. Run python manage.py shell, and then the following commands:

from django.contrib.sites.models import Site
print(Site.objects.first().id)
christianp commented 4 years ago

I've just made a change to first_setup.py which should prevent this kind of problem. Please fetch the latest code and run first_setup.py again (it'll reuse your existing settings, so you don't need to start from scratch)

davidhadas commented 4 years ago

After discarding the prev install and creating a fresh one - this problem, with the new commit is solved