I deployed Django project using cloud code from pycharm.
but in this sample template, there were not the code in installed_app basic apps like these
'django.contrib.admin', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.staticfiles',
there was only 'django.contrib.staticfiles' apps.
Also the default middleweres were not completely installed
INSTALLED_APPS = [
'django.contrib.staticfiles',
'helloapp',
]
MIDDLEWARE = [
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
So, is there any way to use default apps to make login page.?
Related
I have installed django debug toolbar correctly on a pipenv environment and done the main steps, such as adding internal_ips of 127.0.0.1 and adding the debug toolbar to installed_apps and middleware but still whenever I run the server and open a template of an app the debug toolbar doesn't show.
However if I open the page source in the browser, it shows all the list elements of the toolbar however the toolbar doesn't display, does anyone know what is going wrong and how I could fix it.
This are the changes made to the settings.py file:
import mimetypes
mimetypes.add_type("application/javascript", ".js", True)
mimetypes.add_type("text/css", ".css", True)
mimetypes.add_type("text/html", ".html", True)
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'playground',
'debug_toolbar',
]
MIDDLEWARE = [
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
INTERNAL_IPS = [
'127.0.0.1',
]
And the following changes to the urls.py folder:
import debug_toolbar
urlpatterns = [
...,
path('__debug__/', include(debug_toolbar.urls))
]
I've did all the steps which are described in the docs and got the toolbar in admin site. However, I can't get it work in the project frontend side.
Here is my settings:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'debug_toolbar',
...
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
INTERNAL_IPS = ('127.0.0.1', 'localhost',)
I've googled a lot already and non of the proposed solution are not working for me: workaround that shows toolbar even if debug=False, playing with different parameters like INTERCEPT_REDIRECTS=False/True, specifying JQUERY_URL since there is a local jquery which is used by frontend.
I've asked for help from frontend dev, but he can't understand why there is no any configs for client side.
Frontend is using nodes.js and listens on 3000 port than forwards to localhost:8081.
Django version 1.10, django-debug-toolbar 1.9.1.
I am learning Django but have encountered a problem while adding apps to Installed apps in settings.py
I added 'polls' app
INSTALLED_APPS = [
'polls.apps.PollsConfig'
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
but an error has occurred which says
ImportError: No module named 'polls.apps.PollsConfigdjango'; 'polls.apps' is not a package
when I write only 'polls' instead of 'polls.apps.PollsConfig'
the following error occurs `ImportError: No module named 'pollsdjango'
the name of app I am trying to import is 'polls'
You are missing a comma after PollsConfig'
Try this
INSTALLED_APPS = [
'polls.apps.PollsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
When I try and login to my Django app, I am given this error when logging in on localhost
ImportError: No module named 'allauth.account'
But when logging in on the live app (Heroku), there is no error. Any thoughts? It makes it frustrating when I have to push the site for every small change I make on the portion of the site that you have to login to.
settings.py
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'allauth',
# 'allauth.account', Does not work when running the app
#My apps#
'home',
'projects',
'accounts',
'storages',
)
Project Structure
myproject
---accounts
---__init___.py
---views.py
---myproject
---__init___.py
---settings.py
I am getting a traceback identical to the one at this link, http://pastebin.com/Bq1Q0ert, whenever I run my project and visit it at any url.
I had resolved this issue previously by having the project serve at 0.0.0.0:8000, but now this seems to not be working either.
I am running django 1.4 and have under INSTALLED_APPS:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admindocs',
'django.contrib.humanize',
'django.contrib.webdesign',
'admin_tools',
'admin_tools.theming',
'admin_tools.menu',
'admin_tools.dashboard',
'apps.pages',
'apps.news',
'south',
'translatable',
'easy_thumbnails',
'debug_toolbar',
'tinymce',
'rosetta',
'django_extensions',
'sorl.thumbnail',
'vendor.filebrowser',
'vendor.countries')..
UPDATE:
I have found that django.conf.settings.INSTALLED_APPS does not contain what is in settings.INSTALLED_APPS.
I have resolved this issue by adding this code to settings_local;
from settings import *
This does not cause any cyclic imports.