Django + Djangae + Nose / Fail wsgi - python

I'm currently trying to setting up django-nose in my project.
I also used Djangae (https://djangae.readthedocs.org/en/latest/) for app engine compatibility.
I add 'django_nose' in my INSTALLED_APPS
I set TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
Launching "python manage.py test" is not raising any exceptions.
But when I want to launch the server with "python manage.py runserver", the server is running but when I try to call "localhost:8000" I get :
ERROR 2016-03-23 15:59:49,299 wsgi.py:263]
Traceback (most recent call last):
File "/Users/briva/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Users/briva/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Users/briva/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 96, in LoadObject
__import__(cumulative_path)
File "/Users/briva/Desktop/dangoptest/dangoptest/wsgi.py", line 18, in <module>
application = DjangaeApplication(get_wsgi_application())
File "/Users/briva/Desktop/dangoptest/lib/django/core/wsgi.py", line 13, in get_wsgi_application
django.setup()
File "/Users/briva/Desktop/dangoptest/lib/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/briva/Desktop/dangoptest/lib/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/Users/briva/Desktop/dangoptest/lib/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "lib/django_nose/__init__.py", line 5, in <module>
from django_nose.runner import BasicNoseRunner, NoseTestSuiteRunner
File "lib/django_nose/runner.py", line 61, in <module>
from django.test.simple import DjangoTestSuiteRunner as DiscoverRunner
ImportError: No module named simple
Thanks for answers.

Related

Unable to register a app in Django: Getting Exception: ModuleNotFoundError: No module named

1.I created a Django project in the azure function.
2.then I created a app with the name of Scan_domain.
3.Now i'm trying to register in main django settings
enter image description here
I'm unable to register.it is showing the error like this
Worker failed to load function: 'CSFHTTP' with function id: '8e6ff963-aaa3-44b7-9275-72394fca2dc8'.
[2021-12-07T17:03:12.027Z] Result: Failure
Exception: ModuleNotFoundError: No module named 'Scan_Domain'. Troubleshooting Guide: https://aka.ms/functions-modulenotfound
Stack: File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.8\WINDOWS\X64\azure_functions_worker\dispatcher.py", line 305, in handle__function_load_request
func = loader.load_function(
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.8\WINDOWS\X64\azure_functions_worker\utils\wrappers.py", line 42, in call
raise extend_exception_message(e, message)
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.8\WINDOWS\X64\azure_functions_worker\utils\wrappers.py", line 40, in call
return func(*args, **kwargs)
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.8\WINDOWS\X64\azure_functions_worker\loader.py", line 85, in load_function
mod = importlib.import_module(fullmodname)
File "C:\Users\iaila\anaconda3\lib\importlib_init.py", line 127, in import_module
return bootstrap.gcd_import(name[level:], package, level)
File "D:\A_Time_Prov\dev\Cloud_Security\Cloud_Security_fApp\CSFHTTP_init.py", line 4, in
from Cloud_Security.wsgi import application
File "D:\A_Time_Prov\dev\Cloud_Security\Cloud_Security_fApp\Cloud_Security\wsgi.py", line 16, in
application = get_wsgi_application()
File "D:\A_Time_Prov\dev\Cloud_Security\Cloud_Security_fApp\CSFPenv\lib\site-packages\django\core\wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "D:\A_Time_Prov\dev\Cloud_Security\Cloud_Security_fApp\CSFPenv\lib\site-packages\django_init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\A_Time_Prov\dev\Cloud_Security\Cloud_Security_fApp\CSFPenv\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "D:\A_Time_Prov\dev\Cloud_Security\Cloud_Security_fApp\CSFPenv\lib\site-packages\django\apps\config.py", line 224, in create
import_module(entry)
File "C:\Users\iaila\anaconda3\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
Sorry I did not notice it before whats wrong with your project is your project folder structure you Scan_Domain must be in the level where manage.py exist as i can see from your picture it is embeded one level deep probably in the project files...change your project folder structure it will work buddy

Django raising AppRegistryNotReady after update from to 1.9

I have read many similar posts with the same situation and tried a few things suggested if they were at all related. I just updated to Django 1.9 and I received this traceback:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/opt/django/www/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/opt/django/www/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 302, in execute
settings.INSTALLED_APPS
File "/opt/django/www/local/lib/python2.7/site-packages/django/conf/__init__.py", line 55, in __getattr__
self._setup(name)
File "/opt/django/www/local/lib/python2.7/site-packages/django/conf/__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/opt/django/www/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 "/opt/django/www/src/site_aggrigator/__init__.py", line 2, in <module>
import management
File "/opt/django/www/src/site_aggrigator/management/__init__.py", line 4, in <module>
from django.contrib.auth.models import Permission
File "/opt/django/www/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/opt/django/www/local/lib/python2.7/site-packages/django/contrib/auth/base_user.py", line 49, in <module>
class AbstractBaseUser(models.Model):
File "/opt/django/www/local/lib/python2.7/site-packages/django/db/models/base.py", line 94, in __new__
app_config = apps.get_containing_app_config(module)
File "/opt/django/www/local/lib/python2.7/site-packages/django/apps/registry.py", line 239, in get_containing_app_config
self.check_apps_ready()
File "/opt/django/www/local/lib/python2.7/site-packages/django/apps/registry.py", line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
All my apps are installed on my virtual env for sure because the app was running fine before I made the update. I also received this right before my update:
/opt/django/www/local/lib/python2.7/site-packages/Django-1.8-py2.7.egg/django/contrib/auth/models.py:41: RemovedInDjango19Warning: Model class django.contrib.auth.models.Permission doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9.
class Permission(models.Model):
And one post provided a solution of :
INSTALLED_APPS = (
"django.contrib.auth.models.Permission",
Which I also did as they said would be a viable solution. Anyone else had this issue?
Try to add this (after the declaration of SECRET_KEY):
import django
django.setup()

ImportError: cannot import name Connection while adding session?

I have a django project working fine . now i need to add login with session on that project I use mango .
As added in setting.py file
SESSION_ENGINE = 'mango.session'
then it started to give following error:
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
return self.application(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 170, in __call__
self.load_middleware()
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 52, in load_middleware
mw_instance = mw_class()
File "/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/middleware.py", line 11, in __init__
engine = import_module(settings.SESSION_ENGINE)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/shubham/Music/ekomerz/mango/__init__.py", line 2, in <module>
from pymongo import Connection
ImportError: cannot import name Connection
how I can solve this ?
and is there is any other method should i try for login with session ?

Error while trying to deploy django on ec2

I am trying to deploy django that now runs locally on ec2 ubuntu server. I got this while trying to run python mange.py runserver
i searched nothing seems to solve this
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 459, in execute_manager
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 69, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/runserver.py", line 4, in <module>
from django.core.management.commands.runserver import BaseRunserverCommand
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 8, in <module>
from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException, get_internal_wsgi_application
File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 28, in <module>
from django.contrib.staticfiles import handlers
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 8, in <module>
from django.contrib.staticfiles.views import serve
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/views.py", line 15, in <module>
from django.contrib.staticfiles import finders
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 11, in <module>
from django.contrib.staticfiles.storage import AppStaticStorage
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/storage.py", line 10, in <module>
from django.core.cache import (get_cache, InvalidCacheBackendError,
File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 187, in <module>
cache = get_cache(DEFAULT_CACHE_ALIAS)
File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 172, in get_cache
backend, location, params = parse_backend_conf(backend, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 125, in parse_backend_conf
backend = args.pop('BACKEND')
KeyError: 'BACKEND'
Set the backend in your Settings.py

Error with google appengine using pyramid

Using pyramid_appengine my project works fine but, when i deploy to GAE i have this error:
Traceback (most recent call last):
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 187, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 225, in _LoadHandler
handler = __import__(path[0])
File "/base/data/home/apps/s~muncompy/v3.359898035587494190/muncompy/__init__.py", line 36, in <module>
application = make_app()
File "/base/data/home/apps/s~muncompy/v3.359898035587494190/muncompy/__init__.py", line 32, in make_app
config.scan()
File "/base/data/home/apps/s~muncompy/v3.359898035587494190/pyramid/config/__init__.py", line 912, in scan
ignore=ignore)
File "/base/data/home/apps/s~muncompy/v3.359898035587494190/venusian/__init__.py", line 189, in scan
__import__(modname)
File "/base/data/home/apps/s~muncompy/v3.359898035587494190/muncompy/conftest.py", line 6, in <module>
from google.appengine.tools import dev_appserver_index
ImportError: No module named tools
Any ideas for why module tools from google.appengine is missing?

Categories