Saturday, September 23, 2017

First steps in Django 1.11.5 and I have my first error

Hello, this is my first app in Django and I have the next error:
When I launch python manage.py runserver --settings=eventus.settings.local apear this error:

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x110c72158>

Traceback (most recent call last):

  File "/Users/dmuino/eventus/lib/python3.6/site-packages/django/utils/autoreload.py", line 228, in wrapper

    fn(*args, **kwargs)

  File "/Users/dmuino/eventus/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run

    autoreload.raise_last_exception()

  File "/Users/dmuino/eventus/lib/python3.6/site-packages/django/utils/autoreload.py", line 251, in raise_last_exception

    six.reraise(*_exception)

  File "/Users/dmuino/eventus/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise

    raise value.with_traceback(tb)

  File "/Users/dmuino/eventus/lib/python3.6/site-packages/django/utils/autoreload.py", line 228, in wrapper

    fn(*args, **kwargs)

  File "/Users/dmuino/eventus/lib/python3.6/site-packages/django/__init__.py", line 27, in setup

    apps.populate(settings.INSTALLED_APPS)

  File "/Users/dmuino/eventus/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate

    app_config = AppConfig.create(entry)

  File "/Users/dmuino/eventus/lib/python3.6/site-packages/django/apps/config.py", line 120, in create

    mod = import_module(mod_path)

  File "/Users/dmuino/eventus/lib/python3.6/importlib/__init__.py", line 126, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 978, in _gcd_import

  File "<frozen importlib._bootstrap>", line 961, in _find_and_load

  File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked

ModuleNotFoundError: No module named 'myapps'


I separated my setting for different archives.
My setting/base.py is:
"""
Django settings for eventus project.

Generated by 'django-admin startproject' using Django 1.11.5.

For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'vmtu6=u+a-c_qle*+m(kwjpr$n^0ecb&5r0!#=l0vmvw_4j3tn'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

DJANGO_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

LOCAL_APPS = [
    'myapps.events',
]

THIRD_PARTY_APPS = [
]

INSTALLED_APPS = DJANGO_APPS + LOCAL_APPS + THIRD_PARTY_APPS

MIDDLEWARE = [
    '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',
]

ROOT_URLCONF = 'eventus.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'eventus.wsgi.application'


# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/

and my settings/local.py
from .base import *

# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

STATIC_URL = '/static/'

And my tree of my project is the next

eventus

├── __init__.py

├── __pycache__

│   └── __init__.cpython-36.pyc

├── myapps

│   ├── __init__.py

│   └── events

│       ├── __init__.py

│       ├── admin.py

│       ├── apps.py

│       ├── migrations

│       │   └── __init__.py

│       ├── models.py

│       ├── tests.py

│       └── views.py

├── settings

│   ├── __init__.py

│   ├── __pycache__

│   │   ├── __init__.cpython-36.pyc

│   │   ├── base.cpython-36.pyc

│   │   └── local.cpython-36.pyc

│   ├── base.py

│   ├── local.py

│   ├── pro.py

│   └── staging.py

├── urls.py

└── wsgi.py


Could somebody help me to find the problem?


Best regard, I'm a newbie in Django and I want give thanks for any help for me.


--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/94928d39-695d-48a9-8f77-9bc14be3d5dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment