Disable the admin of "Site"
The admin console always displays the admin of "Site" page while this should be hidden for the people on a specific site (they should not be aware of the fact that there are multiple sites) ! When I add the admin.py the following line ``` admin.site.unregister(Site) ``` The (debug) server crashes with the following trace : ``` INFO autoreload P86005 T140161586511872 Watching for file changes with StatReloader Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/home/aazz/Documents/work/Projects/UseSiteAndHistoryFrameworkTogether/venv/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper fn(*args, **kwargs) File "/home/aazz/Documents/work/Projects/UseSiteAndHistoryFrameworkTogether/venv/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run autoreload.raise_last_exception() File "/home/aazz/Documents/work/Projects/UseSiteAndHistoryFrameworkTogether/venv/lib/python3.10/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception raise _exception[1] File "/home/aazz/Documents/work/Projects/UseSiteAndHistoryFrameworkTogether/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 394, in execute autoreload.check_errors(django.setup)() File "/home/aazz/Documents/work/Projects/UseSiteAndHistoryFrameworkTogether/venv/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper fn(*args, **kwargs) File "/home/aazz/Documents/work/Projects/UseSiteAndHistoryFrameworkTogether/venv/lib/python3.10/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/home/aazz/Documents/work/Projects/UseSiteAndHistoryFrameworkTogether/venv/lib/python3.10/site-packages/django/apps/registry.py", line 124, in populate app_config.ready() File "/home/aazz/Documents/work/Projects/UseSiteAndHistoryFrameworkTogether/venv/lib/python3.10/site-packages/django/contrib/admin/apps.py", line 27, in ready self.module.autodiscover() File "/home/aazz/Documents/work/Projects/UseSiteAndHistoryFrameworkTogether/venv/lib/python3.10/site-packages/django/contrib/admin/__init__.py", line 50, in autodiscover autodiscover_modules("admin", register_to=site) File "/home/aazz/Documents/work/Projects/UseSiteAndHistoryFrameworkTogether/venv/lib/python3.10/site-packages/django/utils/module_loading.py", line 58, in autodiscover_modules import_module("%s.%s" % (app_config.name, module_to_search)) File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/home/aazz/Documents/work/Projects/UseSiteAndHistoryFrameworkTogether/UseSiteAndHistoryFrameworkTogether/UseSiteAndHistoryFrameworkTogether/ContactManagementUseSiteAndHistory/admin.py", line 71, in admin.site.unregister(Site) File "/home/aazz/Documents/work/Projects/UseSiteAndHistoryFrameworkTogether/venv/lib/python3.10/site-packages/django/contrib/admin/sites.py", line 161, in unregister raise NotRegistered("The model %s is not registered" % model.__name__) django.contrib.admin.sites.NotRegistered: The model Site is not registered ``` How can I fix this ? \T, -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6685d1ea-fd69-4237-aeee-c7e6f98b2a83n%40googlegroups.com.
makemigrations app shows no installed app available
hi everyone, I am tring to do makemigration Myapp, after creating a project 'Sonam' and app 'Myapp' but output shows No installed app with label 'Myapp' Here is the Directories Structure (.venv) PS C:\Users\dell\p3\Sonam> py manage.py makemigrations Myapp No installed app with label 'Myapp'. (.venv) PS C:\Users\dell\p3\Sonam> dir Directory: C:\Users\dell\p3\Sonam Mode LastWriteTime Length Name - -- d- 1/4/2024 12:09 AM .venv d- 1/4/2024 12:07 AM Myapp d- 1/4/2024 12:07 AM Sonam -a 1/4/2024 12:02 AM 683 manage.py And here are sttings.py INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'Myapp', ] Here is the detail of python and django (.venv) PS C:\Users\dell\p3\Sonam> python --version >> Python 3.10.10 (.venv) PS C:\Users\dell\p3\Sonam> pip show django Name: Django Version: 5.0.1 Summary: A high-level Python web framework that encourages rapid development and clean, pragmatic design. Home-page: https://www.djangoproject.com/ Author: Django Software Foundation Author-email: foundat...@djangoproject.com License: BSD-3-Clause Location: c:\users\dell\p3\sonam\.venv\lib\site-packages Requires: asgiref, sqlparse, tzdata Required-by: (.venv) PS C:\Users\dell\p3\Sonam> py manage.py makemigrations >> No changes detected (.venv) PS C:\Users\dell\p3\Sonam> And (.venv) PS C:\Users\dell\p3\Sonam> py manage.py makemigrations Myapp No installed app with label 'Myapp'. (.venv) PS C:\Users\dell\p3\Sonam> py manage.py makemigrations No changes detected (.venv) PS C:\Users\dell\p3\Sonam> from django.db import models Here is the models.py code # Create your models here. class Task(models.Model): name =models.CharField(max_length=64), surname =models.CharField(max_length=64), Rurserver command is working (.venv) PS C:\Users\dell\p3\Sonam> python manage.py runserver Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run 'python manage.py migrate' to apply them. January 04, 2024 - 01:04:43 Django version 5.0.1, using settings 'Sonam.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK. Please help. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/32f81368-a455-46e1-b17a-615b9c9bf18cn%40googlegroups.com.
Static assets receives 403 on digital ocean.
Hi, please help. I have been trying to deploy my App to digital ocean but after deploying, my static assets do not show. I have set file and directory permissions but still in vain. this is what outputs when inspecting the browser console. help would be highly appreciated: Error logo.png:1 Request unavailable in the network panel, try reloading the inspected pageRequest unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 403 (Forbidden) 6 Unchecked runtime.lastError: The message port closed before a response was received. Error styles.css:1 Request unavailable in the network panel, try reloading the inspected pageRequest unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 403 (Forbidden) Error index.css:1 Request unavailable in the network panel, try reloading the inspected pageRequest unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 403 (Forbidden) Error main.js:1 Request unavailable in the network panel, try reloading the inspected pageRequest unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 403 (Forbidden) Error reload-listener.js:1 Request unavailable in the network panel, try reloading the inspected pageRequest unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 403 (Forbidden) Error /static/sound/click.wav:1 Request unavailable in the network panel, try reloading the inspected pageRequest unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 403 (Forbidden) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABFHQYxzk7bg2cM8TaqAAtDZeQhkjGUmhjiKTEmjL%2BF7Dk-y-A%40mail.gmail.com.