Python Forum
Python RunServer Django script not starting
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python RunServer Django script not starting
#1
triad_realty) root@webettonew:~/triad_realty# python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/root/triad_realty/triad_realty/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/root/triad_realty/triad_realty/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 302, in execute
settings.INSTALLED_APPS
File "/root/triad_realty/triad_realty/local/lib/python2.7/site-packages/django/conf/__init__.py", line 55, in __getattr__
self._setup(name)
File "/root/triad_realty/triad_realty/local/lib/python2.7/site-packages/django/conf/__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/root/triad_realty/triad_realty/local/lib/python2.7/site-packages/django/conf/__init__.py", line 99, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/root/triad_realty/triad_realty/__init__.py", line 1, in <module>
from .celery import app as celery_app
File "/root/triad_realty/triad_realty/celery.py", line 10, in <module>
app = Celery('triad_realty',broker=settings.CELERY_BROKER_URL)
File "/root/triad_realty/triad_realty/local/lib/python2.7/site-packages/django/conf/__init__.py", line 55, in __getattr__
self._setup(name)
File "/root/triad_realty/triad_realty/local/lib/python2.7/site-packages/django/conf/__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/root/triad_realty/triad_realty/local/lib/python2.7/site-packages/django/conf/__init__.py", line 99, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/root/triad_realty/triad_realty/settings.py", line 17, in <module>
ROOT_DIR = environ.Path(__file__) -2 # (triad_realty/config/settings/common.py - 3 = triad_realty/)
AttributeError: 'module' object has no attribute 'Path'


i am struggling to fix this issue please if anybody could help me right away.

i did install environ though the command pip install environ but maybe i need to change the environ.Path but to what if anybody could help me out i would be very thankful i am whole day stuck at it

i am sharing my settings.py file

"""
Django settings for triad_realty project.

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

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

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

from __future__ import absolute_import, unicode_literals

import environ

ROOT_DIR = environ.Path(__file__) -2 # (triad_realty/config/settings/common.py - 3 = triad_realty/)
APPS_DIR = ROOT_DIR.path('triad_realty')

# Global Variable Type
env_path = str(ROOT_DIR.path('.env'))
env = environ.Env()
environ.Env.read_env(env_path)

WEBSITE=env("WEBSITE")

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/ho...checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'i%be$q6@6@79z(54hvmn#2@6kdygctob2$n!&l-^%9s#h_u(^o'

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

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# Apps
'users',
'investor',
'projectowner',
'detail',
'allauth', # registration
'allauth.account',
'django.contrib.humanize',# registration
'djcelery',
'djcelery_email',
]

MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'triad_realty.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [str(APPS_DIR.path('templates')),],
'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',
],
},
},
]

# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672/'

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


WSGI_APPLICATION = 'triad_realty.wsgi.application'

FIXTURE_DIRS = (
str(APPS_DIR.path('fixtures')),
)

EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.smtp.EmailBackend')

# Database
# https://docs.djangoproject.com/en/1.9/re...#databases
if env('DEPLOYMENT') == "testing":
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '127.0.0.1',
'PORT': '3306',
}
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': env('DBNAME'),
'USER': env('DBUSER'),
'PASSWORD': env('DBUSERPASS'),
'HOST': 'localhost',
'PORT': '',
}
}

# Password validation
# https://docs.djangoproject.com/en/1.9/re...validators

# STATIC FILE CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/re...tatic-root

# STATIC FILE CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/re...tatic-root
STATIC_ROOT = str(APPS_DIR('staticfiles'))

# See: https://docs.djangoproject.com/en/dev/re...static-url
STATIC_URL = '/static/'

# See: https://docs.djangoproject.com/en/dev/re...FILES_DIRS
STATICFILES_DIRS = (
str(APPS_DIR.path('static')),
str(APPS_DIR.path('static/css/')),
str(APPS_DIR.path('static/js/')),
)

# See: https://docs.djangoproject.com/en/dev/re...es-finders
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

# MEDIA CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/re...media-root
MEDIA_ROOT = str(APPS_DIR('media'))

# See: https://docs.djangoproject.com/en/dev/re...#media-url
MEDIA_URL = '/media/'


# See: https://docs.djangoproject.com/en/dev/re...pplication

# PASSWORD VALIDATION
# https://docs.djangoproject.com/en/dev/re...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',
},
]

# AUTHENTICATION CONFIGURATION
# ------------------------------------------------------------------------------
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
)

USE_X_FORWARDED_HOST = True
SITE_ID = 1
AUTH_USER_MODEL='users.User'
# Some really nice defaults
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'

ACCOUNT_ALLOW_REGISTRATION = env.bool('DJANGO_ACCOUNT_ALLOW_REGISTRATION', True)


# Custom user app defaults
# Select the correct user model
# AUTH_USER_MODEL = 'users.User'
LOGIN_REDIRECT_URL = '/main'

LOGIN_URL = 'account_login'

ACCOUNT_SIGNUP_FORM_CLASS = 'users.forms.SignupForm'
# Location of root django.contrib.admin URL, use {% url 'admin:index' %}
ADMIN_URL = r'^admin/'

# Your common stuff: Below this line define 3rd party library settings
# ------------------------------------------------------------------------------
ACCOUNT_LOGOUT_ON_GET = True

DEFAULT_EMAIL_FROM = '[email protected]'
EMAIL_USE_SSL = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 465
EMAIL_HOST_USER = env('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD')
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Django project with a setup.py script. That do you think? axju 0 1,612 Oct-22-2019, 10:06 PM
Last Post: axju
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 3,245 Jun-30-2019, 12:21 AM
Last Post: scidam
  Django Runserver ayaz786amd 1 5,091 Nov-17-2018, 04:39 AM
Last Post: ayaz786amd

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020