Django migration - python

I have migrated django website from live server to my localhost, i took the backup of posrgresql database and attached to my localhost i have changed the databse connection details in the live_setting.py and also installed the required packages which were already installed on the live server but i am unable to run the website on my localhost when i use manage.py ruserver command i got the following errors.
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x02BB6530>>
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\django\core\management\commands\runserver.py", line 91, in inner_run self.validate(display_num_errors=True)
File "C:\Python26\lib\site-packages\django\core\management\base.py", line 266,in validate num_errors = get_validation_errors(s, app)
File "C:\Python26\lib\site-packages\django\core\management\validation.py", line 30, in get_validation_errors for (app_name, error) in get_app_errors().items():
File "C:\Python26\lib\site-packages\django\db\models\loading.py", line 158, inget_app_errors self._populate()
File "C:\Python26\lib\site-packages\django\db\models\loading.py", line 67, in_populate self.load_app(app_name)
File "C:\Python26\lib\site-packages\django\db\models\loading.py", line 88, in load_app models = import_module('.models', app_name)
File "C:\Python26\lib\site-packages\django\utils\importlib.py", line 35, in import_module__import__(name)
File "C:\Python26\lib\site-packages\django_social_auth3-0.7.20-py2.6.egg\social_auth\models.py", line 8, in <module>'social_auth.db.django_models'))
File "C:\Python26\lib\site-packages\django\utils\importlib.py", line 35, in import_module__import__(name)
File "C:\Python26\lib\site-packages\django_social_auth3-0.7.20-py2.6.egg\social_auth\db\django_models.py", line 5, in <module>from social_auth.db.base import UserSocialAuthMixin, AssociationMixin, \
File "C:\Python26\lib\site-packages\django_social_auth3-0.7.20-py2.6.egg\social_auth\db\base.py", line 7, in <module> from openid.association import Association as OIDAssociation
File "build\bdist.win32\egg\openid\association.py", line 37, in <module>
File "build\bdist.win32\egg\openid\cryptutil.py", line 33, in <module>
File "build\bdist.win32\egg\openid\oidutil.py", line 16, in <module> ImportError: No module named parse
I am using python 2.6 and django 1.4.3, how can i solve these errors, i am new to python/django development.

Related

Tensorflow Kubernetes Integration Tutorial fails on Ubuntu Xenial

I am following the "Serving Inception Model with TensorFlow Serving and Kubernetes" tutorial from the tensorflow.org website. When I get to loading and exporting the model using
root#ecf82ac60c6b:/serving# bazel-bin/tensorflow_serving/example/inception_saved_model --checkpoint_dir=inception-v3 --output_dir=/tmp/inception-export
I get following error.
Traceback (most recent call last):
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/tf_serving/tensorflow_serving/example/inception_saved_model.py", line 202, in <module>
tf.app.run()
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/python/platform/app.py", line 124, in run
_sys.exit(main(argv))
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/tf_serving/tensorflow_serving/example/inception_saved_model.py", line 198, in main
export()
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/tf_serving/tensorflow_serving/example/inception_saved_model.py", line 91, in export
table = tf.contrib.lookup.index_to_string_table_from_tensor(class_tensor)
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/python/util/lazy_loader.py", line 53, in __getattr__
module = self._load()
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/python/util/lazy_loader.py", line 42, in _load
module = importlib.import_module(self.__name__)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/contrib/__init__.py", line 82, in <module>
from tensorflow.contrib.eager.python import tfe as eager
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/contrib/eager/python/tfe.py", line 76, in <module>
from tensorflow.contrib.eager.python.datasets import Iterator
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/contrib/eager/python/datasets.py", line 23, in <module>
from tensorflow.contrib.data.python.ops import prefetching_ops
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/contrib/data/python/ops/prefetching_ops.py", line 25, in <module>
resource_loader.get_path_to_datafile("../../_prefetching_ops.so"))
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/contrib/util/loader.py", line 55, in load_op_library
ret = load_library.load_op_library(path)
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/python/framework/load_library.py", line 56, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename, status)
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: /serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/contrib/data/python/ops/../../_prefetching_ops.so: undefined symbol: _ZN6google8protobuf8internal9ArenaImpl10AddCleanupEPvPFvS3_E
I tried the solution on How to troubleshoot deployment of Inception serving running in kubernetes, but it does not apply to this problem. Has anyone encountered the same problem and maybe figured out how to solve it?

500 Server Error on GAE - MySQLdb not loaded

I get a 500 Server Error while uploading my app on GAE. It works perfectly fine locally with dev_appserver with SETTINGS_MODE='prod'.
Based on the logs, it cannot find MySQLdb on GAE. It does not make sense to me.
Help!
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 266, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/core/handlers/wsgi.py", line 236, in __call__
self.load_middleware()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/core/handlers/base.py", line 49, in load_middleware
mod = import_module(mw_module)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/contrib/auth/middleware.py", line 3, in <module>
from django.contrib.auth.backends import RemoteUserBackend
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/contrib/auth/backends.py", line 3, in <module>
from django.contrib.auth.models import Permission
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/contrib/auth/models.py", line 8, in <module>
from django.db import models
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/db/__init__.py", line 40, in <module>
backend = load_backend(connection.settings_dict['ENGINE'])
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/db/utils.py", line 93, in __getitem__
backend = load_backend(db['ENGINE'])
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/db/utils.py", line 27, in load_backend
return import_module('.base', backend_name)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/db/backends/mysql/base.py", line 17, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
The answer is fairly simple. Add the following lines in the app.yaml file:
libraries:
- name: MySQLdb
version: "latest"
Details can be found on the page
https://cloud.google.com/appengine/docs/python/cloud-sql

Django-dash memo and news plugin error

I am trying to setup a django-dash demo via: https://github.com/barseghyanartur/django-dash.
I have manually installed all the dependencies for django-dash (because of work computer/proxy issues) and supposedly successfully installed django-dash as well. Following the tutorial, I went to add several layouts and plugins to the INSTALLED_APPS settings for my app. There are no issues when I add all of the plugins except for the ones in asterisks - memo and news.
INSTALLED_APPS = (
# ...
'dash',
'dash.contrib.layouts.android',
'dash.contrib.layouts.bootstrap2',
'dash.contrib.layouts.windows8',
'dash.contrib.plugins.dummy',
'dash.contrib.plugins.image',
**'dash.contrib.plugins.memo',
'dash.contrib.plugins.news',**
'dash.contrib.plugins.rss_feed',
'dash.contrib.plugins.url',
'dash.contrib.plugins.video',
'dash.contrib.plugins.weather',
# ...
)
This is the error message I get. I thought maybe files were missing but when I check the folders, autoreload.py etc are all there. What might be the issue?
Unhandled exception in thread started by <function wrapper at 0x0208ECB0>
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 93, in w
rapper
fn(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.
py", line 101, in inner_run
self.validate(display_num_errors=True)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 310,
in validate
num_errors = get_validation_errors(s, app)
File "C:\Python27\lib\site-packages\django\core\management\validation.py", lin
e 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 196, in
get_app_errors
self._populate()
File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 75, in
_populate
self.load_app(app_name, True)
File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 99, in
load_app
models = import_module('%s.models' % app_name)
File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 40, in im
port_module
__import__(name)
File "C:\Python27\lib\site-packages\django_dash-0.4.5-py2.7.egg\dash\models.py
", line 21, in <module>
class DashboardSettings(models.Model):
File "C:\Python27\lib\site-packages\django_dash-0.4.5-py2.7.egg\dash\models.py
", line 32, in DashboardSettings
layout_uid = models.CharField(_("Layout"), max_length=25, choices=get_regist
ered_layouts())
File "C:\Python27\lib\site-packages\django_dash-0.4.5-py2.7.egg\dash\base.py",
line 1491, in get_registered_layouts
ensure_autodiscover()
File "C:\Python27\lib\site-packages\django_dash-0.4.5-py2.7.egg\dash\base.py",
line 1432, in ensure_autodiscover
autodiscover()
File "C:\Python27\lib\site-packages\django_dash-0.4.5-py2.7.egg\dash\discover.
py", line 33, in autodiscover
do_discover(PLUGINS_MODULE_NAME)
File "C:\Python27\lib\site-packages\django_dash-0.4.5-py2.7.egg\dash\discover.
py", line 27, in do_discover
__import__('{0}.{1}'.format(app, module_name))
File "C:\Python27\lib\site-packages\django_dash-0.4.5-py2.7.egg\dash\contrib\p
lugins\memo\dash_plugins.py", line 10, in <module>
from dash.contrib.plugins.memo.forms import MemoForm, TinyMCEMemoForm
File "C:\Python27\lib\site-packages\django_dash-0.4.5-py2.7.egg\dash\contrib\p
lugins\memo\forms.py", line 9, in <module>
from tinymce.widgets import TinyMCE
File "C:\Python27\lib\site-packages\django_tinymce-1.5.2-py2.7.egg\tinymce\wid
gets.py", line 10, in <module>
import tinymce.settings
File "C:\Python27\lib\site-packages\django_tinymce-1.5.2-py2.7.egg\tinymce\set
tings.py", line 16, in <module>
JS_ROOT = getattr(settings, 'TINYMCE_JS_ROOT',os.path.join(settings.STATIC_R
OOT, 'tiny_mce'))
File "C:\Python27\lib\ntpath.py", line 64, in join
result_drive, result_path = splitdrive(path)
File "C:\Python27\lib\ntpath.py", line 94, in splitdrive
if p[1:2] == ':':
TypeError: 'NoneType' object has no attribute '__getitem__'
As documented (recently), django-tinymce package is required for news and memo plugins.
https://github.com/barseghyanartur/django-dash/tree/master/src/dash/contrib/plugins/news
https://github.com/barseghyanartur/django-dash/tree/master/src/dash/contrib/plugins/memo
Unfortunately, django-tinymce is not yet compatible with Python 3 (there is, however, a python 3 compatible branch which is aimed to become master one day).
In case you're using Python 3, you should simply use TinyMCE without django-tinymce (which isn't much work anyway).

Django Failure After Installing Zinnia

Was on a Linux machine, working on a Django website. Recently got a new computer and am running windows 8 on it. I am using PyCharm, and am trying to start the local server up for the first time. The last dependency I installed was zinnia, and now it is giving me this odd error. This is the output that PyCharm is giving me before not working.
Unhandled exception in thread started by <bound method Command.inner_run of
<django.contrib.staticfiles.management.commands.runserver.Command object at 0x029643F0>>
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py",
line 92, in inner_run
self.validate(display_num_errors=True)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 280, in
validate
num_errors = get_validation_errors(s, app)
File "C:\Python27\lib\site-packages\django\core\management\validation.py", line 35, in
get_validation_errors
for (app_name, error) in get_app_errors().items():
File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 166, in
get_app_errors
self._populate()
File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 72, in _populate
self.load_app(app_name, True)
File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 96, in load_app
models = import_module('.models', app_name)
File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 35, in
import_module
__import__(name)
File "C:\Python27\lib\site-packages\django_blog_zinnia-0.12.3-py2.7.egg\zinnia\models
\__init__.py", line 2, in <module>
from zinnia.models.entry import Entry
File "C:\Python27\lib\site-packages\django_blog_zinnia-0.12.3-py2.7.egg\zinnia\models
\entry.py", line 23, in <module>
from zinnia.models.author import Author
File "C:\Python27\lib\site-packages\django_blog_zinnia-0.12.3-py2.7.egg\zinnia\models
\author.py", line 10, in <module>
class Author(User):
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 123, in __new__
raise TypeError("%s cannot proxy the swapped model '%s'." % (name, base_meta.swapped))
TypeError: Author cannot proxy the swapped model 'main.MyUser'.
Although the error suggests that you are using the newest version of zinnia (12.3) it seem that's not the case. If you look at the models/authors.py file of the current version you will see:
class Author(get_user_model()):
"""
Proxy model around :class:`django.contrib.auth.models.get_user_model`.
"""
which will deal with Django 1.5's custom user model. The traceback you supplied has the following:
class Author(User):
which is the old approach. Have a look here for more information:
https://github.com/Fantomas42/django-blog-zinnia/issues/215
https://github.com/Fantomas42/django-blog-zinnia/commit/81ad5de6a0cf5b6fc9b79ca1649c4ee822c4f2d4

Invalid default_markup_type Django

I'm getting an exception when I start my Django server. I use python manage.py runserver 0.0.0.0:80 to start the server.
I'm getting this exception: ValueError: Invalid default_markup_type for field 'None', allowed values: html, plain
Here's the stack trace:
Validating models...
Failed to setup thread-interrupt handler. This is usually not critical
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x2274c90>>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 91, in inner_run
self.validate(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 266, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 30, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 158, in get_app_errors
self._populate()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 64, in _populate
self.load_app(app_name, True)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 88, in load_app
models = import_module('.models', app_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/kcastillo/NMCSVs/nmcsv/models.py", line 29, in <module>
class Description(UserData):
File "/home/kcastillo/NMCSVs/nmcsv/models.py", line 30, in Description
text = MarkupField("Description", default_markup_type='markdown')
File "/usr/local/lib/python2.7/dist-packages/markupfield/fields.py", line 106, in __init__
(name, ', '.join(self.markup_choices_list)))
ValueError: Invalid default_markup_type for field 'None', allowed values: html, plain
The exception is coming this line of code:
text = MarkupField("Description", default_markup_type='markdown')
These are all working. I just can't get it to run on my VM after I checked it out from our svn.
Thanks.
Apparently, I was missing the markdown module for Django. Since Django didn't complain that I didn't have this module in the beginning, I got confused with the error.
The solution was to install the module.
pip install markdown

Categories

Resources