Django app engine cannot import name old_dev_appserver - python

I am trying to use django in appengine. I have followed the installation documentation and setup the project. But ./manage.py runserver command is generating error.
Traceback is,
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/salman/projects/appengine/banglapy/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/home/salman/projects/appengine/banglapy/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/salman/projects/appengine/banglapy/django/core/management/__init__.py", line 263, in fetch_command
app_name = get_commands()[subcommand]
File "/home/salman/projects/appengine/banglapy/django/core/management/__init__.py", line 109, in get_commands
apps = settings.INSTALLED_APPS
File "/home/salman/projects/appengine/banglapy/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/home/salman/projects/appengine/banglapy/django/conf/__init__.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "/home/salman/projects/appengine/banglapy/django/conf/__init__.py", line 132, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/home/salman/projects/appengine/banglapy/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/salman/projects/appengine/banglapy/banglapy/settings.py", line 6, in <module>
from djangoappengine.settings_base import *
File "/home/salman/projects/appengine/banglapy/djangoappengine/settings_base.py", line 8, in <module>
from djangoappengine.utils import on_production_server, have_appserver
File "/home/salman/projects/appengine/banglapy/djangoappengine/utils.py", line 24, in <module>
"Error was: %s" % e)
Exception: Could not get appid. Is your app.yaml file missing? Error was: cannot import name old_dev_appserver
how can I resolve this issue?

Google removed the old dev_appserver from the SDK in version 1.9.17. There is an issue on the djangoappengine project about it as well.
https://github.com/django-nonrel/djangoappengine/issues/95

Related

TypeError: the 'package' argument is required to perform a relative import for './myapp/manage.py.test_settings'

Trying to run python django tests script inside AWS Linux:
./runtests.sh ./myapp/manage.py
and get the below error. Does anyone know what this means and what I should do? manage.py is in the main directory and test_settings.py is in a sub directory called myapp
./deploy-scripts/runtests.sh ./myapp/manage.py
Traceback (most recent call last):
File "manage.py", line 18, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/python37/lib/python3.7/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/usr/local/python37/lib/python3.7/site-packages/django/core/management/__init__.py", line 363, in execute
settings.INSTALLED_APPS
File "/usr/local/python37/lib/python3.7/site-packages/django/conf/__init__.py", line 82, in __getattr__
self._setup(name)
File "/usr/local/python37/lib/python3.7/site-packages/django/conf/__init__.py", line 69, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/python37/lib/python3.7/site-packages/django/conf/__init__.py", line 170, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/python37/lib/python3.7/importlib/__init__.py", line 122, in import_module
raise TypeError(msg.format(name))
TypeError: the 'package' argument is required to perform a relative import for './myapp/manage.py.test_settings'
./deploy-scripts/runtests.sh: line 57: flake8: command not found
------------------------
There were failed tests!
Scroll up for details

Getting Error While running manage.py ...import Error cannot import name backend

Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/devbase/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/devbase/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute
django.setup()
File "/home/devbase/env/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/devbase/env/local/lib/python2.7/site-packages/django/apps/registry .py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/devbase/env/local/lib/python2.7/site-packages/django/apps/config.p y", line 94, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/devbase/env/local/lib/python2.7/site-packages/djorm_pgtrgm/__init_ _.py", line 1, in <module>
from django.db import backend
ImportError: cannot import name backend
It looks like you are using djorm_pgtrgm. It hasn't been updated for two years, so you can't expect it to work with recent versions of Django.
This merged pull request suggests that the import error has been fixed in the GitHub repo, but there hasn't been a release since then. You could try installing from source, but you should think about whether you want to use an unmaintained package in your project.

error in lfs installation in python "no module named lfs_theme

I am following an installation in lfs to insert a check out page in my website. I have copies all the instruction but after I tried to mia it produces an error.
(my_project) PS C:\my_project\src> python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\my_project\lib\site-
packages\django\core\management\__init__.py", line 367, in
execute_from_command_line
utility.execute()
File "C:\my_project\lib\site-
packages\django\core\management\__init__.py", line 341, in execute
django.setup()
File "C:\my_project\lib\site-packages\django\__init__.py", line 27, in
setup
apps.populate(settings.INSTALLED_APPS)
File "C:\my_project\lib\site-packages\django\apps\registry.py", line 85,
in populate
app_config = AppConfig.create(entry)
File "C:\my_project\lib\site-packages\django\apps\config.py", line 90, in
create
module = import_module(entry)
File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named lfs_theme
(my_project) PS C:\my_project\src>

python3 manage.py runserver for Django

I can't run Django server and this is the problem :
MacBook-Pro-di-viv:vivsite viv$ python3 manage.py runserver
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 303, in execute
settings.INSTALLED_APPS
File "/usr/local/lib/python3.5/site-packages/django/conf/__init__.py", line 48, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.5/site-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.5/site-packages/django/conf/__init__.py", line 92, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 121, in import_module
raise TypeError(msg.format(name))
TypeError: the 'package' argument is required to perform a relative import for '.settings'
I had this problem after this Python command line:
>>> settings.configure()
Can someone help me? Thanks!
I asssume that your settings file is called ".settings.py".
Did you try to rename it without starting by "." ?

Django Error loading MySqlDB module

I'm new with Django and I follow a tuto. The problem is that the tuto uses Sqlite but I want to use MySql server instead. I changed the parameters following documentation but I have the following error when I try to run the server. I already found some resolve but it didn't work...
For your information, I installed MySql-Python and reinstall Django with PIP. Without any success. I hope you will be able to help me.
Traceback :
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\adescamp>cd C:\Users\adescamp\agregmail
C:\Users\adescamp\agregmail>python manage.py runserver 8000
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 280, in execute
translation.activate('en-us')
File "C:\Python27\lib\site-packages\django\utils\translation\__init__.py", line 130, in activate
return _trans.activate(language)
File "C:\Python27\lib\site-packages\django\utils\translation\trans_real.py", line 188, in activate
_active.value = translation(language)
File "C:\Python27\lib\site-packages\django\utils\translation\trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "C:\Python27\lib\site-packages\django\utils\translation\trans_real.py", line 159, in _fetch
app = import_module(appname)
File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 40, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django\contrib\admin\__init__.py", line 6, in <module>
from django.contrib.admin.sites import AdminSite, site
File "C:\Python27\lib\site-packages\django\contrib\admin\sites.py", line 4, in <module>
from django.contrib.admin.forms import AdminAuthenticationForm
File "C:\Python27\lib\site-packages\django\contrib\admin\forms.py", line 6, in <module>
from django.contrib.auth.forms import AuthenticationForm
File "C:\Python27\lib\site-packages\django\contrib\auth\forms.py", line 17, in <module>
from django.contrib.auth.models import User
File "C:\Python27\lib\site-packages\django\contrib\auth\models.py", line 48, in <module>
class Permission(models.Model):
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 96, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 264, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Python27\lib\site-packages\django\db\models\options.py", line 124, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:\Python27\lib\site-packages\django\db\__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Python27\lib\site-packages\django\db\utils.py", line 198, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:\Python27\lib\site-packages\django\db\utils.py", line 113, in load_backend
return import_module('%s.base' % backend_name)
File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 40, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django\db\backends\mysql\base.py", line 17, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
Thank you!
I found the solution!
I had to install mysql-python. Easy but: don't do that with PIP because it won't work. You have to install mysql-p
as you are running python on windows. Pip install mysql-python won't work. Try using python-mysql from here http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

Categories