I know there are Duplicates of this question, but they didn't solve the issue.
my django app is conflicting between django-user-acccounts; account and allauth.account
M Installed App
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'accounts.apps.AccountsConfig',
'django.contrib.sites',
# 'allauth',
'allauth.account', # django-allauth # conflict
'allauth.socialaccount',
'crispy_forms',
'account', # django-user-accounts #conflict
'pinax.referrals',
'kingEstateCore',
'widget_tweaks',
]
I've tried renaming the account package inside my site_packages but no success.
I've also tried adding AppConfig but there was no apps.py module insite my site_packages/account.
Any Ideas pls
Error TraceBack
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "c:\users\user\appdata\local\programs\python\python36\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "c:\users\user\appdata\local\programs\python\python36\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\USER\Desktop\KingAfam\KingENV\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "C:\Users\USER\Desktop\KingAfam\KingENV\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\USER\Desktop\KingAfam\KingENV\lib\site-packages\django\utils\autoreload.py", line 76, in raise_last_exception
raise _exception[1]
File "C:\Users\USER\Desktop\KingAfam\KingENV\lib\site-packages\django\core\management\__init__.py", line 357, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\USER\Desktop\KingAfam\KingENV\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "C:\Users\USER\Desktop\KingAfam\KingENV\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\USER\Desktop\KingAfam\KingENV\lib\site-packages\django\apps\registry.py", line 95, in populate
"duplicates: %s" % app_config.label)
django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: account
Related
Each time i include the Django Rest Framework in my installed apps in my settings.py file, I get an error while starting my server.
The Error Message below:
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File"C:\Users\gchukwuma\AppData\Local\Programs\Python\Python37\lib\threading.py", line 926, in _bootstrap_inner self.run()
File"C:\Users\gchukwuma\AppData\Local\Programs\Python\Python37\lib\threading.py", line 870, in run self._target(*self._args, **self.kwargs)
File "C:\Users\gchukwuma\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper fn(*args, **kwargs)
File "C:\Users\gchukwuma\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 110, in inner_run autoreload.raise_last_exception()
File "C:\Users\gchukwuma\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception raise exception[1]
File "C:\Users\gchukwuma\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management_init.py", line 375, in execute autoreload.check_errors(django.setup)()
File "C:\Users\gchukwuma\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper fn(*args, **kwargs)
File "C:\Users\gchukwuma\AppData\Local\Programs\Python\Python37\lib\site-packages\django_init.py", line 24, in setup apps.populate(settings.INSTALLED_APPS)
File "C:\Users\gchukwuma\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\registry.py", line 122, in populate app_config.ready()
File "C:\Users\gchukwuma\AppData\Local\Programs\Python\Python37\lib\site-packages\rest_framework\apps.py", line 10, in ready from .checks import pagination_system_check # NOQA
ValueError: source code string cannot contain null bytes
The Settings.py file:
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'base.apps.BaseConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework'
]
I'm using django 1.8 and satchmo project. But after successful installation of satchmo project when I try to start the server it's showing me this error
`Traceback (most recent call last):
File "manage.py", line 25, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 308, in execute
settings.INSTALLED_APPS
File "/usr/local/lib/python2.7/site-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/site-packages/django/conf/__init__.py", line 110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/Cellar/python#2/2.7.16_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named skeleton.settings`
INSTALLED_APPS = (
'django.contrib.sites',
'satchmo_store.shop',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.auth',
'django.contrib.contenttypes',
#'django.contrib.comments',
'django.contrib.sessions',
'django.contrib.sitemaps',
'django.contrib.staticfiles',
'django.contrib.messages',
'django_comments',
'registration',
'sorl.thumbnail',
'keyedcache',
'livesettings',
'l10n',
'satchmo_utils.satchmo_thumbnail',
'satchmo_store.contact',
'tax',
'tax.modules.no',
'tax.modules.area',
'tax.modules.percent',
'shipping',
#'satchmo_store.contact.supplier',
#'shipping.modules.tiered',
#'satchmo_ext.newsletter',
#'satchmo_ext.recentlist',
'product',
'product.modules.configurable',
'product.modules.custom',
'product.modules.downloadable',
'product.modules.subscription',
#'satchmo_ext.product_feeds',
#'satchmo_ext.brand',
'payment',
'payment.modules.dummy',
#'payment.modules.purchaseorder',
#'payment.modules.giftcertificate',
#'satchmo_ext.wishlist',
#'satchmo_ext.upsell',
#'satchmo_ext.productratings',
'satchmo_ext.satchmo_toolbar',
'satchmo_utils',
#'shipping.modules.tieredquantity',
#'satchmo_ext.tieredpricing',
#'debug_toolbar',
'app_plugins',
'simple',
'store.localsite',
'skeleton',
)
Here I've added to installed apps. Still, it doesn't work. Can you tell me the use of the skeleton?
Also somehow skeleton doesn't compatible with django 1.8.
I'm trying to build my first web application using Django.
I'm actually referring to Using Python With Oracle Database 11g (under the section 'Using the Django Framework')
however while trying to execute the command python manage.py runserver i'm getting an error
Steps followed
django-admin.py startproject myproj
cd myproj
python manage.py startapp myapp
Once the above commands were executed successfully, the next step was to modify the connection settings to allow the application to connect to the database in the file myproj/settings.py.
Here i updated the details with our database details
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': '<our ebs database name>',
'USER': <username>,
'PASSWORD': <password>,
}
}
Also added the project under the INSTALLED_APPS to associate the application with the project:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myproj.myapp'
]
In a terminal window when i try to execute the below command from myproj directory:
python manage.py runserver
I'm getting the below error message
C:\Users\xxx\Desktop\Python files\myproj>python manage.py runserver
Unhandled exception in thread started by .wrapper at 0x00000274CA28AEA0>
Traceback (most recent call last):
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\config.py", line 118, in create
cls = getattr(mod, cls_name)
AttributeError: module 'myproj' has no attribute 'myapp'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\config.py", line 123, in create
import_module(entry)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\importlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'myproj.myapp'
I am a novice of Django.I think the problem is myproj.myapp. You don't need the project name, just add 'myapp', to INSTALLED_APPS.Hope it will be helpful.
From the "Writing your first Django app, part 2: Activating models" tutorial:
To include the app in our project, we need to add a reference to its configuration class in the INSTALLED_APPS setting. The PollsConfig class is in the polls/apps.py file, so its dotted path is 'polls.apps.PollsConfig'. Edit the mysite/settings.py file and add that dotted path to the INSTALLED_APPS setting. It’ll look like this:
mysite/settings.py¶
INSTALLED_APPS = [
'polls.apps.PollsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
So look in myproj/apps.py and see what the name of the class is and your INSTALLED_APP should be something like:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myproj.apps.MyprojConfig'
]
I am using djangae with some third party applications like all-auth, django-invitations and django rest framework. When I hit python manage.py migrate I get the following error.
AttributeError: type object 'ContentType' has no attribute 'objects'
The full trace is following
Traceback (most recent call last):
File "manage.py", line 26, in <module>
execute_from_command_line(sys.argv)
File "/home/salman/Workspace/chaipani/lib/djangae/core/management/__init__.py", line 43, in execute_from_command_line
return _execute_from_command_line(djangae_namespace.sandbox, argv, parser=djangae_parser, **overrides)
File "/home/salman/Workspace/chaipani/lib/djangae/core/management/__init__.py", line 68, in _execute_from_command_line
return django_management.execute_from_command_line(argv)
File "/home/salman/Workspace/chaipani/lib-vendor/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/home/salman/Workspace/chaipani/lib-vendor/django/core/management/__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/salman/Workspace/chaipani/lib-vendor/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/salman/Workspace/chaipani/lib-vendor/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/salman/Workspace/chaipani/lib-vendor/django/core/management/commands/migrate.py", line 227, in handle
self.verbosity, self.interactive, connection.alias, apps=post_migrate_apps, plan=plan,
File "/home/salman/Workspace/chaipani/lib-vendor/django/core/management/sql.py", line 53, in emit_post_migrate_signal
**kwargs
File "/home/salman/Workspace/chaipani/lib-vendor/django/dispatch/dispatcher.py", line 193, in send
for receiver in self._live_receivers(sender)
File "/home/salman/Workspace/chaipani/lib-vendor/django/contrib/auth/management/__init__.py", line 63, in create_permissions
ctype = ContentType.objects.db_manager(using).get_for_model(klass)
AttributeError: type object 'ContentType' has no attribute 'objects'
My installed apps:
INSTALLED_APPS = [
'djangae',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'djangae.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'djangae.contrib.security',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
'invitations',
]
Any help anyone?
I am facing an issue of importing rest_framework inside my django app whenever i try to make migrations or create superuser or simply run the runserver.
I have installed the framework using this command but django still doesn't recognize it
sudo pip install djangorestframework
here's the snippet of settings.py file:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'companies.apps.CompaniesConfig',
]
REST_FRAMEWORK = {
'DEFAULT_MODEL_SERIALIZER_CLASS':
'rest_framework.serializers.HyperlinkedModelSerializer',
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
]
}
Output:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/tam/Enthought/Canopy_64bit/User/lib/python2.7/site-packages
/django/core/management/__init__.py", line 364
in execute_from_command_line utility.execute()
File "/home/tam/Enthought/Canopy_64bit/User/lib/python2.7/site-packages
/django/core/management/__init__.py", line 338, in execute
django.setup()
File "/home/tam/Enthought/Canopy_64bit/User/lib/python2.7/site-packages
/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/tam/Enthought/Canopy_64bit/User/lib/python2.7/site-packages
/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/tam/Enthought/Canopy_64bit/User/lib/python2.7/site-packages
/django/apps/config.py", line 94, in create
module = import_module(entry)
File "/home/tam/Canopy/appdata/canopy-1.7.4.3348.rh5-x86_64/lib/python2.7/
importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named rest_framework