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
Related
I am trying to configure django-activity-stream for my project using the guidelines here django-activity-stream
I have models User(django-contrib-auth), Article
As mentioned in the docs, I register the models for the activity using the statements
registry.register(User)
registry.register(Article)
while executing the runserver command, I get the following error
Unhandled exception in thread started by <function wrapper at 0x7f3a680547d0>
Traceback (most recent call last):
File "/home/xxxx/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 93, in wrapp
er
fn(*args, **kwargs)
File "/home/xxxx/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py",
line 102, in inner_run
self.validate(display_num_errors=True)
File "/home/xxxx/local/lib/python2.7/site-packages/django/core/management/base.py", line 310, in
validate
num_errors = get_validation_errors(s, app)
File "/home/xxxx/local/lib/python2.7/site-packages/django/core/management/validation.py", line 34
, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/home/xxxx/local/lib/python2.7/site-packages/django/db/models/loading.py", line 196, in get
_app_errors
self._populate()
File "/home/xxxx/local/lib/python2.7/site-packages/django/db/models/loading.py", line 75, in _pop
ulate
self.load_app(app_name, True)
File "/home/xxxx/local/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load
_app
models = import_module('%s.models' % app_name)
File "/home/xxxx/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import
_module
__import__(name)
File "/home/xxxx/local/lib/python2.7/site-packages/registration/models.py", line 15, in <module>
User = get_user_model()
File "/home/xxxx/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 127, in
get_user_model
user_model = get_model(app_label, model_name)
File "/home/xxxx/local/lib/python2.7/site-packages/django/db/models/loading.py", line 271, in get
_model
self._populate()
File "/home/xxxx/local/lib/python2.7/site-packages/django/db/models/loading.py", line 75, in _pop
ulate
self.load_app(app_name, True)
File "/home/xxxx/local/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load
_app
models = import_module('%s.models' % app_name)
File "/home/xxxx/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import
_module
__import__(name)
File "/home/xxxx/maldio/maldio_project/links/models.py", line 115, in <module>
registry.register(User)
File "/home/xxxx/local/lib/python2.7/site-packages/actstream/registry.py", line 85, in register
self[model_class] = setup_generic_relations(model_class)
File "/home/xxxx/local/lib/python2.7/site-packages/actstream/registry.py", line 39, in setup_gene
ric_relations
setattr(Action, attr_value, None)
AttributeError: 'NoneType' object has no attribute 'actions_with_auth_user_as_actor'
Is there something that I missed?
Thanks in advance
This is an issue with version 0.5.1 of django-activity-stream. You can fix this error by removing 0.5.1 and installing 0.5 version.
You can track this bug here:
https://github.com/justquick/django-activity-stream/issues/208
Looks like you're "User" variable has a null object in it, rather than a valid User object.
What is the code you are using to create the "User" and "Article" objects that you are passing in the functions that you show?
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).
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.
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
i'm trying to syncdb for a forum django package called Dinnete but keep getting this error :
>>> os.system("python manage.py syncdb")
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "C:\Python27\lib\site-packages\django\core\mana
utility.execute()
File "C:\Python27\lib\site-packages\django\core\mana
self.fetch_command(subcommand).run_from_argv(self.
File "C:\Python27\lib\site-packages\django\core\mana
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django\core\mana
self.validate()
File "C:\Python27\lib\site-packages\django\core\mana
num_errors = get_validation_errors(s, app)
File "C:\Python27\lib\site-packages\django\core\mana
for (app_name, error) in get_app_errors().items():
File "C:\Python27\lib\site-packages\django\db\models
self._populate()
File "C:\Python27\lib\site-packages\django\db\models
self.load_app(app_name, True)
File "C:\Python27\lib\site-packages\django\db\models
models = import_module('.models', app_name)
File "C:\Python27\lib\site-packages\django\utils\imp
__import__(name)
File "D:\projects\online\goulcg\dinette\models.py",
logging.config.fileConfig(settings.LOG_FILE_NAME,d
File "C:\Python27\lib\logging\config.py", line 70, i
formatters = _create_formatters(cp)
File "C:\Python27\lib\logging\config.py", line 106,
flist = cp.get("formatters", "keys")
File "C:\Python27\lib\ConfigParser.py", line 599, in
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'formatters'
does anyone have an idea what is going on ? or how to fix it
please help
thanks in advance
The problem is with your logging configuration in settings.py.
If you do not care about logging at the moment, you can delete the entire section that looks like this:
LOGGING = {
...
...
...
}
or replace it with this default example from the django docs site:
https://docs.djangoproject.com/en/dev/topics/logging/#an-example