django configParser error - python

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

Related

TypeError: context must be a dict rather than Context

I'm trying to build a search engine into a django blog application and when I ran the command:
>>> manage.py build_solr_schema
I got this error:
Traceback (most recent call last):
File "C:\Users\KOLAPO\Google Drive\Python\Websites\mysite\manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\django\core\management\__init__.py", line 363, in execute_from_command_line
utility.execute()
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\django\core\management\__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\haystack\management\commands\build_solr_schema.py", line 29, in handle
schema_xml = self.build_template(using=using)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\haystack\management\commands\build_solr_schema.py", line 57, in build_template
return t.render(c)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\django\template\backends\django.py", line 64, in render
context = make_context(context, request, autoescape=self.backend.engine.autoescape)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\django\template\context.py", line 287, in make_context
raise TypeError('context must be a dict rather than %s.' % context.__class__.__name__)
TypeError: context must be a dict rather than Context.
What's wrong?
Note: I'm using Solr and Django-haystack for the search engine
I think this issue has been fixed by pull request 1504, but it looks like there hasn't been a release since then.

Upgrading to Django 1.7. AssertionError: To use StatusField, the model 'ShellRequest' must have a STATUS choices class attribute

I was upgrading from Django 1.6 to 1.7. Python 2.7 is installed which is compatible with Django 1.7. While I did run the code python manage.py makemigrations, I got the following error message:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/m akemigrations.py", line 111, in handle
convert_apps=app_labels or None,
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/autodetector.py", line 42, in changes
changes = self._detect_changes(convert_apps, graph)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/autodetector.py", line 109, in _detect_changes
self.old_apps = self.from_state.render(ignore_swappable=True)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/state.py", line 67, in render
model.render(self.apps)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/state.py", line 312, in render
body,
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 284, in __new__
new_class._prepare()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 344, in _prepare
signals.class_prepared.send(sender=cls)
File "/usr/local/lib/python2.7/dist-packages/django/dispatch/dispatcher.py", line 198, in send
response = receiver(signal=self, sender=sender, **named)
File "/usr/local/lib/python2.7/dist-packages/model_utils/fields.py", line 57, in prepare_class
% sender.__name__
AssertionError: To use StatusField, the model 'ShellRequest' must have a STATUS choices class attribute.
Reading the blogpost here, I couldn't figure out where to start. If anyone can give me a guideline how to deal with this issue would be appreciated.
The choices class field attribute is probably what you're looking for.
If you are using django-model-utils, the choices section of the package doc might help too.

Django AttributeError: 'getfullargspec' object has no attribute 'default'

I teared down Django-oscar for practice and rebuild it not in capacity of a plugin app but as Django project. Now I am having this issue but couldn't figure out what it is related to exactly. Can someone help me to resolve this?
Following is the error I am getting:
When I run command "python manage.py shell" I get this error.
(supermarket) C:\Users\shazia\supermarket\market>python manage.py shell
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\_
_init__.py", line 354, in execute_from_command_line
utility.execute()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\_
_init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\b
ase.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\b
ase.py", line 445, in execute
output = self.handle(*args, **options)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 69, in handle
self.run_shell(shell=options['interface'])
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 58, in run_shell
return getattr(self, shell)()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 41, in ipython
ip()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 34, in _ipython
from IPython import start_ipython
File "C:\Users\shazia\supermarket\lib\site-packages\IPython\__init__.py", li
ne 47, in <module>
from .core.application import Application
File "C:\Users\shazia\supermarket\lib\site-packages\IPython\core\application
.py", line 22, in <module>
from traitlets.config.application import Application, catch_config_error
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\__init_
_.py", line 6, in <module>
from .application import *
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\applica
tion.py", line 120, in <module>
class Application(SingletonConfigurable):
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\applica
tion.py", line 291, in Application
def initialize(self, argv=None):
File "<decorator-gen-1>", line 2, in catch_config_error
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 232,
in decorate
evaldict, __wrapped__=func)
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 219,
in create
self = cls(func, name, signature, defaults, doc, module)
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 109,
in __init__
setattr(self, a, getattr(argspec, a))
AttributeError: 'getfullargspec' object has no attribute 'default'
You are on Windows as per the error description. Use 'manage.py shell' instead of 'python manage.py shell'.

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).

Why am I getting an error message when trying to run manage.py?

Getting a list of errors in cmd prompt (Windows 8) when trying to run manage.py.
I am trying to follow this tutorial: http://wiki.thinkhole.org/howto:django_on_windows/
I am a little less than half way down the tutorial page.
Can someone please tell me what is going wrong and how to get back on track?
I am trying to get django installed on my computer so i can create a web page with python.
The actual command prompt error log is this:
C:\Py\Scripts\testproject>manage.py runserver
Traceback (most recent call last):
File "C:\Py\Scripts\testproject\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Py\lib\site-packages\django\core\management\__init__.py", line 399, i
n execute_from_command_line
utility.execute()
File "C:\Py\lib\site-packages\django\core\management\__init__.py", line 392, i
n execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Py\lib\site-packages\django\core\management\base.py", line 242, in ru
n_from_argv
self.execute(*args, **options.__dict__)
File "C:\Py\lib\site-packages\django\core\management\base.py", line 280, in ex
ecute
translation.activate('en-us')
File "C:\Py\lib\site-packages\django\utils\translation\__init__.py", line 130,
in activate
return _trans.activate(language)
File "C:\Py\lib\site-packages\django\utils\translation\trans_real.py", line 18
8, in activate
_active.value = translation(language)
File "C:\Py\lib\site-packages\django\utils\translation\trans_real.py", line 17
7, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "C:\Py\lib\site-packages\django\utils\translation\trans_real.py", line 15
9, in _fetch
app = import_module(appname)
File "C:\Py\lib\site-packages\django\utils\importlib.py", line 40, in import_m
odule
__import__(name)
File "C:\Py\lib\site-packages\django\contrib\admin\__init__.py", line 3, in <m
odule>
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
File "C:\Py\lib\site-packages\django\contrib\admin\helpers.py", line 7, in <mo
dule>
from django.contrib.contenttypes.models import ContentType
File "C:\Py\lib\site-packages\django\contrib\contenttypes\models.py", line 129
, in <module>
class ContentType(models.Model):
File "C:\Py\lib\site-packages\django\db\models\base.py", line 96, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
TypeError: Error when calling the metaclass bases
__init__() keywords must be strings
C:\Py\Scripts\testproject>

Categories

Resources