lzjun567 / django_blog Goto Github PK
View Code? Open in Web Editor NEWa blog powered by django
Home Page: http://foofish.net
a blog powered by django
Home Page: http://foofish.net
syncdb的时候出现错误
(django_blog)[root@dbp django_blog]# python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/root/django_blog/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/root/django_blog/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/root/django_blog/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/root/django_blog/lib/python2.7/site-packages/django/core/management/base.py", line 284, in execute
self.validate()
File "/root/django_blog/lib/python2.7/site-packages/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/root/django_blog/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 "/root/django_blog/lib/python2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
File "/root/django_blog/lib/python2.7/site-packages/django/db/models/loading.py", line 75, in _populate
self.load_app(app_name, True)
File "/root/django_blog/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' % app_name)
File "/root/django_blog/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/root/django_blog/lib/python2.7/site-packages/reversion/models.py", line 116, in <module>
'''
UnicodeEncodeError at /admin/blog/blog/add/
'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
Environment:
Request Method: GET
Request URL: http://115.159.51.252/admin/blog/blog/add/
Django Version: 1.8.7
Python Version: 2.7.6
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.sitemaps',
'apps.blog',
'apps.wedding',
'pagedown',
'compressor',
'debug_toolbar']
Installed Middleware:
(u'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'middleware.profile.ProfilerMiddleware')
Template error:
In template /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/includes/fieldset.html, error at line 19
ascii
9 : {% for field in line %}
10 : <div{% if not line.fields|length_is:'1' %} class="field-box{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}{% if field.field.is_hidden %} hidden{% endif %}"{% elif field.is_checkbox %} class="checkbox-row"{% endif %}>
11 : {% if not line.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %}
12 : {% if field.is_checkbox %}
13 : {{ field.field }}{{ field.label_tag }}
14 : {% else %}
15 : {{ field.label_tag }}
16 : {% if field.is_readonly %}
17 :
{{ field.contents }}
18 : {% else %}
19 : {{ field.field }}
20 : {% endif %}
21 : {% endif %}
22 : {% if field.field.help_text %}
23 :
{{ field.field.help_text|safe }}
24 : {% endif %}
25 :
26 : {% endfor %}
27 :
28 : {% endfor %}
29 :
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
response = response.render()
self.content = self.rendered_content
content = template.render(context, self._request)
return self.template.render(context)
return self._render(context)
return self.nodelist.render(context)
bit = self.render_node(node, context)
return node.render(context)
return compiled_parent._render(context)
return self.nodelist.render(context)
bit = self.render_node(node, context)
return node.render(context)
return compiled_parent._render(context)
return self.nodelist.render(context)
bit = self.render_node(node, context)
return node.render(context)
result = block.nodelist.render(context)
bit = self.render_node(node, context)
return node.render(context)
result = block.nodelist.render(context)
bit = self.render_node(node, context)
return node.render(context)
nodelist.append(node.render(context))
return template.render(context)
return self._render(context)
return self.nodelist.render(context)
bit = self.render_node(node, context)
return node.render(context)
nodelist.append(node.render(context))
nodelist.append(node.render(context))
return nodelist.render(context)
bit = self.render_node(node, context)
return node.render(context)
return nodelist.render(context)
bit = self.render_node(node, context)
return node.render(context)
output = force_text(output)
s = six.text_type(s)
klass.**unicode** = lambda self: mark_safe(klass_unicode(self))
return self.as_widget()
return force_text(widget.render(name, self.value(), attrs=attrs))
'widget': self.widget.render(name, value, _args, *_kwargs),
options = self.render_options(choices, [value])
for option_value, option_label in chain(self.choices, choices):
yield self.choice(obj)
return (self.field.prepare_value(obj), self.field.label_from_instance(obj))
return smart_text(obj)
return force_text(s, encoding, strings_only, errors)
s = six.text_type(bytes(s), encoding, errors)
Exception Type: UnicodeEncodeError at /admin/blog/blog/add/
Exception Value: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
xiyanxiyan10@kali:~/project/django_blog$ python manage.py migrate apps.blog
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 399, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 392, 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 242, in run_from_argv
self.execute(_args, *_options.dict)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute
output = self.handle(_args, *_options)
File "/usr/local/lib/python2.7/dist-packages/south/management/commands/migrate.py", line 111, in handle
ignore_ghosts = ignore_ghosts,
File "/usr/local/lib/python2.7/dist-packages/south/migration/init.py", line 173, in migrate_app
Migrations.calculate_dependencies()
File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 229, in calculate_dependencies
migration.calculate_dependencies()
File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 363, in calculate_dependencies
for migration in self._get_dependency_objects("depends_on"):
File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 343, in _get_dependency_objects
for app, name in getattr(self.migration_class(), attrname, []):
File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 315, in migration_class
return self.migration().Migration
File "/usr/local/lib/python2.7/dist-packages/south/utils/init.py", line 62, in method
value = function(self)
File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 304, in migration
raise exceptions.UnknownMigration(self, sys.exc_info())
south.exceptions.UnknownMigration: Migration 'reversion:0001_initial' probably doesn't exist.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 302, in migration
migration = import(full_name, {}, {}, ['Migration'])
File "/usr/local/lib/python2.7/dist-packages/reversion/migrations/0001_initial.py", line 4, in
from django.db import models, migrations
ImportError: cannot import name migrations
Traceback (most recent call last):
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/django/utils/autoreload.py", line 229, in wrapper
fn(_args, *_kwargs)
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run
autoreload.raise_last_exception()
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/django/utils/autoreload.py", line 252, in raise_last_exception
six.reraise(__exception)
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/django/utils/autoreload.py", line 229, in wrapper
fn(_args, **kwargs)
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/django/init.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/debug_toolbar/apps.py", line 15, in ready
dt_settings.patch_all()
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/debug_toolbar/settings.py", line 237, in patch_all
patch_middleware_classes()
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/debug_toolbar/settings.py", line 216, in patch_middleware_classes
if not is_toolbar_middleware_installed():
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/debug_toolbar/settings.py", line 196, in is_toolbar_middleware_installed
from debug_toolbar.middleware import DebugToolbarMiddleware
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/debug_toolbar/middleware.py", line 17, in
from debug_toolbar.toolbar import DebugToolbar
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/debug_toolbar/toolbar.py", line 167, in
urlpatterns = DebugToolbar.get_urls()
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/debug_toolbar/toolbar.py", line 161, in get_urls
for panel_class in cls.get_panel_classes():
File "/home/ubuntu/.virtualenvs/django_blog/lib/python3.4/site-packages/debug_toolbar/toolbar.py", line 138, in get_panel_classes
(panel_module, e))
django.core.exceptions.ImproperlyConfigured: Error importing debug panel debug_toolbar.panels.templates: "cannot import name 'get_standard_processors'"
想问下 这是什么问题
python和django都是什么版本的
(django_blog)[root@localhost django_blog]# python manage.py migrate reversion
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/django/core/management/init.py", line 399, in execute_from_command_line
utility.execute()
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(_args, *_options.dict)
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(_args, *_options)
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
ignore_ghosts = ignore_ghosts,
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/init.py", line 173, in migrate_app
Migrations.calculate_dependencies()
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/base.py", line 229, in calculate_dependencies
migration.calculate_dependencies()
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/base.py", line 363, in calculate_dependencies
for migration in self._get_dependency_objects("depends_on"):
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/base.py", line 343, in _get_dependency_objects
for app, name in getattr(self.migration_class(), attrname, []):
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/base.py", line 315, in migration_class
return self.migration().Migration
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/utils/init.py", line 62, in method
value = function(self)
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/base.py", line 304, in migration
raise exceptions.UnknownMigration(self, sys.exc_info())
south.exceptions.UnknownMigration: Migration 'reversion:0001_initial' probably doesn't exist.
Traceback (most recent call last):
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/base.py", line 302, in migration
migration = import(full_name, {}, {}, ['Migration'])
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/reversion/migrations/0001_initial.py", line 4, in
from django.db import models, migrations
ImportError: cannot import name migrations
(django_blog)[root@localhost django_blog]#
unable to open database file
如果没有标签的话,打开标签页面会有一个报错,主要原因是
max_count = max(tag_list_have_blog, key=lambda tag: tag.blog_count).blog_count
min_count = min(tag_list_have_blog, key=lambda tag: tag.blog_count).blog_count
这两句话在tag_list_have_blog
为空的时候,max
和min
函数报错,前面最好加个判断
我尝试在sae上用这套东西,但sae上面数据库用户是没有 rolled back权限,我在后台发布blog时,就会提示“Exception Value: Some non-transactional changed tables couldn't be rolled back”
但我一直没找到这个rolled back是在哪里出现的
http://django-china.cn/topic/727/?page=1#p3078
我想把分类显示到顶端,但改完之后没有显示,能帮看下问题出在哪里不~
下载完成后还需要,才能正常使用
rm -rf (工程目录)/apps/blog/migrations/
我安装好了,后台有添加友情链接,是激活的,但是前端不显示还是,请问怎么查
你好,我在GitHub上看到你的博客项目。想请问一下,像你博客的文章基于Markdown,是怎么实现的呢?在后台写的文章发布的前台是需要做什么处理么?图片是怎么处理的,我没在model看到啊?
(django_blog)[root@localhost django_blog]# python manage.py syncdb
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
Synced:
django.contrib.admin
django.contrib.auth
django.contrib.contenttypes
django.contrib.sessions
django.contrib.messages
django.contrib.staticfiles
django.contrib.sitemaps
pagedown
south
compressor
debug_toolbar
Not synced (use migrations):
(django_blog)[root@localhost django_blog]# python manage.py migrate apps.blog
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/django/core/management/init.py", line 399, in execute_from_command_line
utility.execute()
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(_args, *_options.dict)
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(_args, *_options)
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
ignore_ghosts = ignore_ghosts,
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/init.py", line 173, in migrate_app
Migrations.calculate_dependencies()
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/base.py", line 229, in calculate_dependencies
migration.calculate_dependencies()
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/base.py", line 363, in calculate_dependencies
for migration in self._get_dependency_objects("depends_on"):
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/base.py", line 343, in _get_dependency_objects
for app, name in getattr(self.migration_class(), attrname, []):
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/base.py", line 315, in migration_class
return self.migration().Migration
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/utils/init.py", line 62, in method
value = function(self)
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/base.py", line 304, in migration
raise exceptions.UnknownMigration(self, sys.exc_info())
south.exceptions.UnknownMigration: Migration 'reversion:0001_initial' probably doesn't exist.
Traceback (most recent call last):
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/south/migration/base.py", line 302, in migration
migration = import(full_name, {}, {}, ['Migration'])
File "/root/.virtualenvs/django_blog/lib/python2.7/site-packages/reversion/migrations/0001_initial.py", line 4, in
from django.db import models, migrations
ImportError: cannot import name migrations
找了半天,貌似没找到。。 原谅
Environment:
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.6.2
Python Version: 2.6.6
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sitemaps',
'reversion',
'apps.blog',
'pagedown',
'south',
'apps.bootstrap_pagination',
'compressor',
'debug_toolbar')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Template error:
In template D:\zeero.zhang\app\python\web\django_blog\apps\blog\templates\index.html, error at line 2
'myapp_markup' is not a valid tag library: ImportError raised loading apps.blog.templatetags.myapp_markup: No module named markdown2
1 : {% extends "base.html" %}
2 : {% load myapp_markup %}
3 : {% load bootstrap_pagination %}
4 :
5 : {% block description %}FooFish的自话自说,Bloger,Enginner{%endblock%}
6 : {% block title %}FooFish的自话自说{% endblock %}
7 :
8 : {% block content %}
9 : {% for blog in blogs %}
10 :
11 :
12 : {{blog.title}}
Traceback:
File "C:\Python26\lib\site-packages\django\core\handlers\base.py" in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
return render(request, 'index.html', {'blogs':blogs})
return HttpResponse(loader.render_to_string(_args, *_kwargs),
t = get_template(template_name)
template, origin = find_template(template_name)
source, display_name = loader(name, dirs)
return self.load_template(template_name, template_dirs)
template = get_template_from_string(source, origin, template_name)
return Template(source, origin, name)
self.nodelist = compile_string(template_string, origin)
return parser.parse()
compiled_result = compile_func(self, token)
nodelist = parser.parse()
compiled_result = compile_func(self, token)
(taglib, e))
Exception Type: TemplateSyntaxError at /
Exception Value: 'myapp_markup' is not a valid tag library: ImportError raised loading apps.blog.templatetags.myapp_markup: No module named markdown2
你好,我的python版本:2.7.9,django版本:1.8.2,执行“python manage.py syncdb”包如下错误:
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/pyenv/versions/2.7.9/lib/python2.7/site-packages/django/core/management/init.py", line 338, in execute_from_command_line
utility.execute()
File "/usr/local/pyenv/versions/2.7.9/lib/python2.7/site-packages/django/core/management/init.py", line 312, in execute
django.setup()
File "/usr/local/pyenv/versions/2.7.9/lib/python2.7/site-packages/django/init.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/pyenv/versions/2.7.9/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/usr/local/pyenv/versions/2.7.9/lib/python2.7/site-packages/debug_toolbar/apps.py", line 15, in ready
dt_settings.patch_all()
File "/usr/local/pyenv/versions/2.7.9/lib/python2.7/site-packages/debug_toolbar/settings.py", line 237, in patch_all
patch_middleware_classes()
File "/usr/local/pyenv/versions/2.7.9/lib/python2.7/site-packages/debug_toolbar/settings.py", line 216, in patch_middleware_classes
if not is_toolbar_middleware_installed():
File "/usr/local/pyenv/versions/2.7.9/lib/python2.7/site-packages/debug_toolbar/settings.py", line 196, in is_toolbar_middleware_installed
from debug_toolbar.middleware import DebugToolbarMiddleware
File "/usr/local/pyenv/versions/2.7.9/lib/python2.7/site-packages/debug_toolbar/middleware.py", line 17, in
from debug_toolbar.toolbar import DebugToolbar
File "/usr/local/pyenv/versions/2.7.9/lib/python2.7/site-packages/debug_toolbar/toolbar.py", line 167, in
urlpatterns = DebugToolbar.get_urls()
File "/usr/local/pyenv/versions/2.7.9/lib/python2.7/site-packages/debug_toolbar/toolbar.py", line 161, in get_urls
for panel_class in cls.get_panel_classes():
File "/usr/local/pyenv/versions/2.7.9/lib/python2.7/site-packages/debug_toolbar/toolbar.py", line 138, in get_panel_classes
(panel_module, e))
django.core.exceptions.ImproperlyConfigured: Error importing debug panel debug_toolbar.panels.templates: "cannot import name get_standard_processors"
pip相关的包已经安装了!
博客不错,学习学习,
我在查看‘归档’时页面显示有问题
/home/ubuntu/env/django_blog/bin/gunicorn
失败原因在于脚本会加载这个文件,而virtualenv并不会生成这个,求该文件是否是工程中拷贝过去的
克隆了你的项目,但是报一个错误:ModuleNotFoundError: No module named 'pagedown'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.