2015-01-29 4 views
10

मुझे लगता है कि मैं वास्तव में ऊपर कुछ खराब कर दिया है है। मेरी Django एप्लिकेशन (उत्पादन एक) को मैं एक प्रमुख अद्यतन धक्का दिया और कर रहा हूँ कि जब भी मैं अपने डोमेन के लिए जाने की कोशिश एक "आंतरिक सर्वर त्रुटि" मिलता है। मैं अपने uwsgi लॉग में एक त्रुटि हो रही है:Django अनुप्रयोग अनुचित रूप से कॉन्फ़िगर - एप्लिकेशन मॉड्यूल एकाधिक फ़ाइल व्यवस्था स्थिति

*** Starting uWSGI 2.0.8 (64bit) on [Thu Jan 29 00:36:43 2015] *** 
compiled with version: 4.8.2 on 11 December 2014 17:29:38 
os: Linux-3.13.0-41-generiC#70-Ubuntu SMP Tue Nov 25 14:40:34 UTC 2014 
nodename: ip-172-31-9-208 
machine: x86_64 
clock source: unix 
detected number of CPU cores: 1 
current working directory:/
detected binary path: /usr/local/bin/uwsgi 
!!! no internal routing support, rebuild with pcre support !!! 
uWSGI running as root, you can use --uid/--gid/--chroot options 
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
chdir() to /home/ubuntu/web/app 
*** WARNING: you are running uWSGI without its master process manager *** 
your processes number limit is 15922 
your memory page size is 4096 bytes 
detected max file descriptor number: 1024 
lock engine: pthread robust mutexes 
thunder lock: disabled (you can enable it with --thunder-lock) 
uwsgi socket 0 bound to UNIX address /home/ubuntu/web/ppuwsgi.sock fd 3 
Python version: 3.4.0 (default, Apr 11 2014, 13:08:40) [GCC 4.8.2] 
Set PythonHome to /home/ubuntu/.virtualenvs/pennypledge 
*** Python threads support is disabled. You can enable it with --enable-threads *** 
Python main interpreter initialized at 0xb57780 
your server socket listen backlog is limited to 100 connections 
your mercy for graceful operations on workers is 60 seconds 
mapped 72768 bytes (71 KB) for 1 cores 
*** Operational MODE: single process *** 
added /home/ubuntu/web/ to pythonpath. 
Traceback (most recent call last): 
    File "/home/ubuntu/.virtualenvs/pennypledge/lib/python3.4/site-packages/django/apps/config.py", line 104, in create 
    entry = module.default_app_config 
AttributeError: 'module' object has no attribute 'default_app_config' 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "./pennypledge/wsgi.py", line 14, in <module> 
    application = get_wsgi_application() 
    File "/home/ubuntu/.virtualenvs/pennypledge/lib/python3.4/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application 
    django.setup() 
    File "/home/ubuntu/.virtualenvs/pennypledge/lib/python3.4/site-packages/django/__init__.py", line 21, in setup 
    apps.populate(settings.INSTALLED_APPS) 
    File "/home/ubuntu/.virtualenvs/pennypledge/lib/python3.4/site-packages/django/apps/registry.py", line 85, in populate 
    app_config = AppConfig.create(entry) 
File "/home/ubuntu/.virtualenvs/pennypledge/lib/python3.4/site-packages/django/apps/config.py", line 107, in create 
    return cls(entry, module) 
    File "/home/ubuntu/.virtualenvs/pennypledge/lib/python3.4/site-packages/django/apps/config.py", line 41, in __init__ 
    self.path = self._path_from_module(app_module) 
    File "/home/ubuntu/.virtualenvs/pennypledge/lib/python3.4/site-packages/django/apps/config.py", line 70, in _path_from_module 
    "with a 'path' class attribute." % (module, paths)) 
django.core.exceptions.ImproperlyConfigured: The app module <module 'ledger' (namespace)> has multiple filesystem locations (['./ledger', '/home/ubuntu/web/app/ledger']); you must configure this app with an AppConfig subclass with a 'path' class attribute. 
unable to load app 0 (mountpoint='') (callable not found or import error) 
*** no app loaded. going in full dynamic mode *** 
*** uWSGI is running in multiple interpreter mode *** 
spawned uWSGI worker 1 (and the only) (pid: 8549, cores: 1) 
--- no python application found, check your startup logs for errors --- 
[pid: 8549|app: -1|req: -1/1] 71.195.197.2() {42 vars in 828 bytes} [Wed Jan 28 17:36:54 2015] GET/=> generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0) 
--- no python application found, check your startup logs for errors --- 
[pid: 8549|app: -1|req: -1/2] 71.195.197.2() {42 vars in 814 bytes} [Wed Jan 28 17:36:56 2015] GET /favicon.ico => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (1 switches on core 0) 
--- no python application found, check your startup logs for errors --- 
[pid: 8549|app: -1|req: -1/3] 71.195.197.2() {38 vars in 640 bytes} [Wed Jan 28 17:37:09 2015] GET/=> generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (1 switches on core 0) 
--- no python application found, check your startup logs for errors --- 
[pid: 8549|app: -1|req: -1/4] 162.243.163.123() {40 vars in 751 bytes} [Wed Jan 28 17:37:09 2015] GET /favicon.ico => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (1 switches on core 0) 
--- no python application found, check your startup logs for errors --- 
[pid: 8549|app: -1|req: -1/5] 71.195.197.2() {40 vars in 748 bytes} [Wed Jan 28 17:37:10 2015] GET /favicon.ico => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (1 switches on core 0) 
--- no python application found, check your startup logs for errors --- 
[pid: 8549|app: -1|req: -1/6] 71.195.197.2() {38 vars in 591 bytes} [Wed Jan 28 17:37:11 2015] GET /favicon.ico => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0) 

मैं क्या The app module <module 'ledger' (namespace)> has multiple filesystem locations (['./ledger', '/home/ubuntu/web/app/ledger']); you must configure this app with an AppConfig subclass with a 'path' class attribute. चल रहा है द्वारा पता नहीं है।

DEBUG = True 
TEMPLATE_DEBUG = DEBUG 


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


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

# SECURITY WARNING: keep the secret key used in production secret! 
SECRET_KEY = '<SECRET_KEY>' 


ALLOWED_HOSTS = ['.example.com','.example2.com'] 


# Application definition 

INSTALLED_APPS = (
    'django.contrib.admin', 
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'ledger', 
    'extension', 
    'plugin', 
    'emailmanager', 
    'bookmarklet', 
    'social.apps.django_app.default', 
) 

MIDDLEWARE_CLASSES = (
    '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 = 'pennypledge.urls' 

WSGI_APPLICATION = 'pennypledge.wsgi.application' 

AUTH_USER_MODEL = 'ledger.User' 


DATABASES = { 
    'default': { 
     'ENGINE': 'postgresql_psycopg2', 
     'NAME': 'database',      # Or path to database file if using sqlite3. 
     # The following settings are not used with sqlite3: 
     'USER': 'user', 
     'PASSWORD': 'password', 
     'HOST': '',      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 
     'PORT': '',      # Set to empty string for default. 
    } 
} 

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

LANGUAGE_CODE = 'en-us' 

TIME_ZONE = 'MST' 

USE_I18N = True 

USE_L10N = True 

USE_TZ = False #I don't think we care about TZ's. If we do then we need to change the deleting of transaction code. 


STATIC_URL = '/static/' 

STATICFILES_DIRS = (
    'C:/pennypledge/pennypledge/static/', 
    '/Users/croberts/pennypledge/static/', 
) 

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth', 
    'django.core.context_processors.debug', 
    'django.core.context_processors.i18n', 
    'django.core.context_processors.media', 
    'django.core.context_processors.static', 
    'django.core.context_processors.tz', 
    'django.contrib.messages.context_processors.messages', 
    'social.apps.django_app.context_processors.backends', 
    'social.apps.django_app.context_processors.login_redirect', 
) 

AUTHENTICATION_BACKENDS = (
    'social.backends.facebook.FacebookOAuth2', 
    'ledger.custom_social_auth.YoutubeOAuth2', 
    'social.backends.twitter.TwitterOAuth', 
    'django.contrib.auth.backends.ModelBackend', 
) 

अन्त में जब मैं कोड के पिछले संस्करण चेकआउट करने के लिए प्रयास करते हैं,:

यहाँ मेरी settings.py फ़ाइल है। मुझे एक ही समस्या है।

संपादित करें - जोड़ने uwsgi.conf फ़ाइल

# file: /etc/init/ppuwsgi.conf 
description "uWSGI server for PennyPledge" 

start on runlevel [2345] 
stop on runlevel [!2345] 

respawn 
exec /usr/local/bin/uwsgi --home /home/ubuntu/web/app/ --socket /home/ubuntu/web/ppuwsgi.sock --chmod-socket=666 --module=pennypledge.wsgi --pythonpath /home/ubuntu/web/ -H /home/ubuntu/.virtualenvs/pennypledge --logto /home/ubuntu/web/logs/uwsgi.log --chdir=/home/ubuntu/web/app --chmod-socket=666 

हालांकि, मैं क्यों यह uwsgi की गलती होगी पता नहीं है, के रूप में मैं केवल Django परियोजना अपडेट किया गया।

+0

हम आपके uWSGI विन्यास देख सकते हैं? एक '.ini' फ़ाइल या कुछ? और अपने 'wsgi.py' –

+0

मेरे समस्या दृश्य स्टूडियो था: मैं एक ऐप्लिकेशन का नाम बदला, तो यह चले गए, और वी.एस. डर के सभी स्थानांतरित नहीं किया। –

उत्तर

44

समस्या यह है कि मैं एक __init__.py फ़ाइल नष्ट किया गया। जाहिर है, django उन्हें यह जानने के लिए उपयोग करता है कि कौन से फ़ोल्डर्स पैकेज हैं, इसलिए वे बहुत महत्वपूर्ण हैं।

+0

यह स्वीकार्य उत्तर होना चाहिए! मुझे एक ही समस्या थी और __init__.py ने समस्या को हल किया। धन्यवाद! – Richard

+0

मुझे इसी तरह की त्रुटि थी और इसने मुझे मेरे समाधान के लिए सुराग दिया, __init__.py परिभाषित default_app_config = 'app_name.apps.Class_name' और apps.py ने कक्षा वर्ग_नाम (AppConfig) भी परिभाषित किया: नाम = 'app_name' मेरे पास डिफ़ॉल्ट_app_config टिप्पणी है __init__.py में – Paullo

1

त्रुटि अपने ledger अनुप्रयोग में है। क्या यह एक कस्टम ऐप है?

Django स्रोत कोड से, त्रुटि, त्वरित सुधार के रूप में से _path_from_module(app_module)

# Filesystem path to the application directory eg. 
    # u'/usr/lib/python2.7/dist-packages/django/contrib/admin'. Unicode on 
    # Python 2 and a str on Python 3. 
    if not hasattr(self, 'path'): 
     self.path = self._path_from_module(app_module) 

आता है अगर यह आपके अनुप्रयोग है, तो आप एक AppConfig उपवर्ग एक वैध path विशेषता है कि इसके साथ कॉन्फ़िगर कर सकते हैं, जो होगा निष्पादन से बग को रोकें। मैं इसे और आगे देख रहा हूं।

यदि ledger आपका ऐप नहीं है, और आपने इसे pip या किसी अन्य माध्यम से अपडेट किया है, तो यह बताता है कि पुराने संस्करण की जांच करने से समस्या ठीक नहीं होती है। उस ऐप का पुराना संस्करण अपने भंडार से प्राप्त करने का प्रयास करें (यदि लागू हो) और एक बग रिपोर्ट सबमिट करें।

+0

यह एक कस्टम ऐप है। क्या आप AppConfig को उप-वर्गीकृत करने का उदाहरण पोस्ट कर सकते हैं। मैं दस्तावेज़ों को देख रहा हूं लेकिन अभी भी थोड़ा उलझन में हूं। –

+0

हाहा! मैं समझ गया! मैंने \ _ \ _ init__.py फ़ाइल हटा दी थी। मुझे नहीं पता कि यह क्या करता है या यह मेरी मशीन पर स्थानीय रूप से क्यों काम करेगा, लेकिन यह तय है। –

+0

दिलचस्प। इनट फ़ाइलों का उपयोग बहुत सारी चीजों के लिए किया जा सकता है, जैसे मॉड्यूल लोड करना और कॉन्फ़िगर करना, व्यवस्थापक साइट इत्यादि। बस सुनिश्चित करें कि आप यह देखते हैं कि त्रुटि के कारण यह क्या कर रहा था। यदि यह आपके लेख उपयोगकर्ता मॉडल का समर्थन करता है, तो आप इसे गड़बड़ नहीं करना चाहते हैं! –

संबंधित मुद्दे