ImportError: cannot import name model - django

Hello everyone.
This is the first time I ask for help on StackOverflow, so please forgive me if my question here is clear enough... I will gladly provide anything you ask me for in order to have a better understanding of this issue
I have Django project that is not importing a model from an app that is registered on my settings.
This app has been working good until 2 day ago, but I haven't made any changes related to models.
I have tried many things to fix this issue but still giving me the same error...
I can't import anything coming from the models on any of my apps...
This is very frustrating. Please some advise
INSTALLED_APPS = (
# Django Applications
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.sitemaps',
# 'satchmo_store.shop',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.staticfiles',
'django.contrib.messages',
'django_comments',
'django.contrib.humanize',
# Reorder admin apps
'admin_reorder',
# Third Party Django Applications
## 'django_extensions',
'photologue',
'sorl.thumbnail',
'filebrowser',
'widget_tweaks',
'snowpenguin.django.recaptcha2',
'tinymce',
'django_extensions',
'model_utils',
'cart',
'anymail',
'rest_framework',
'storages',
# 'django_s3_storage',
'my_project.libs.chunks',
'my_project.apps.definition',
'my_project.apps.makeaword',
'my_project.apps.tellinstories',
'my_project.apps.wordsearch',
'my_project.libs.payflowpro',
# Project Applications
'my_project.apps.accounts',
'my_project.apps.book',
'my_project.apps.general',
'my_project.apps.illustrate',
'my_project.apps.write',
'my_project.apps.pressroom',
'my_project.apps.images',
'my_project.apps.comic',
'my_project.apps.library',
'my_project.apps.reports',
'my_project.apps.orders',
'my_project.apps.gift_cards',
'my_project.apps.stationary',
'my_project.apps.invoices',
'my_project.apps.cart_itt',
)

Import like:
from general.models import GiftCardOrders

Related

improperly configured app in settings.py of django

Tying to register my djano app in the settings section of my django project. but when i run the server i am getting an error in the terminal.
django.core.exceptions.ImproperlyConfigured: 'site1app.apps' does not contain a class 'Site1appConfig'. Choices are: 'Site1AppConfig'.
I dont know what's going wrong as i just added it to the list of installed apps in settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'site1app.apps.Site1appConfig',
]
This looks like a miss on the capitalization for your class
Change:
'site1app.apps.Site1appConfig'
To:
'site1app.apps.Site1AppConfig'

Authenticating user problem with django-tenant-schema

I want to have admin module available to tenants (using django-tenant-schema).
My apps section of settings.py:
# Application definition
SHARED_APPS = (
'tenant_schemas', # mandatory, should always be before any django app
'customers', # you must list the app where your tenant model resides in
# 'django.contrib.sites',
# everything below here is optional
)
TENANT_APPS = (
'django.contrib.contenttypes',
# your tenant-specific apps
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
INSTALLED_APPS = (
'tenant_schemas', # mandatory, should always be before any django app
'customers',
# 'django.contrib.sites', #using this will cause error - see my stackoverflow question
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
I have set up 2 schemas (tenant1 and public). Created superuser and can see that superuser is created within tenant1 schema. However when trying to log in at tenant1.domain.com/admin, getting login screen but after entering credentials keep getting:
ProgrammingError at /admin/login/ relation "auth_user" does not exist
Looks like it is not picking up my tenant1 schema?
What I have to change in configuration?
Make sure tenant middleware is installed.
It's responsible for negotiating which tenant is called and connecting to the right schemas.

Django 1.10 - Plug new app into django

I have a trouble with plugging recently created app called pages into a django project.
My pages apps.py
from django.apps import AppConfig
class PagesConfig(AppConfig):
name = 'pages'
My settings.py, installed apps:
INSTALLED_APPS = [
'pages.apps.PagesConfig' # pages.apps.pages fails too
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
ImportError: No module named 'pages.apps.PagesConfigdjango';
'pages.apps' is not a package
Does anyonw knows what is wrong there? I did everything according the docs, but django still cannot to plug my app. Any insights appreciated.
You are missing a comma after your entry.
'pages.apps.PagesConfig',

import error No module named 'project\\order'

I'm using oscar and added from fork order app. After added that cant run syncdb or server. It is giving an error import error: No module named 'project\\order'
from oscar import get_core_apps
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.flatpages',
'django.contrib.sites',
'compressor',
] + get_core_apps(['project\order'])
SITE_ID = 1
this is my installed apps. I didnt understand why it doing this.
This get_core_apps(['project\order']) should be get_core_apps(['project.order']).
I changed project to oscar.apps.order and it did work. But why, it is a question for me.

No available plugins for templates

I'm following the Django-CMS introductory tutorial and have got everything working up to the point where I can run my server and access the admin interface.
However, when I add a page, I cannot select any plugin, it just says No Plugins present. Add a plugin to this placeholder-slot.
In my settings.py file I have:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'cms',
'mptt',
'menus',
'south',
'sekizai',
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
What am I doing wrong here?
Plugins in django-cms are being discovered by looking for cms_plugins module inside each of INSTALLED_APPS. Plugins shipped with the CMS are stored in several separate modules so you should add a line for each of your desired plugins:
INSTALLED_APPS = (
...
'cms.plugins.flash',
'cms.plugins.googlemap',
...
)