对我的Django应用程序模型进行了一些更改,并使用South在我的开发机器上迁移它们(迁移0004到0009).但是当尝试在服务器上迁移这些更改时,我收到"GhostMigrations"错误.
没有太多好的内容来解释ghost迁移是什么,或者如何调试它.Google对此问题没有帮助,其他提到幽灵迁移的SO问题也没有涵盖这一点(这里最有用的问题主要是关于工作流程).django-south IRC中有用的人对此进行了关于鬼迁移的说法:"这意味着南方的历史(数据库中的一个表)记录了它认为已应用的两个迁移,但其迁移文件无法找到" .我现在想弄清楚如何完成调试.
在此先感谢您的帮助.
这是错误:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/home/username/webapps/myproject/lib/python2.6/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/home/username/webapps/myproject/lib/python2.6/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/username/webapps/myproject/lib/python2.6/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/username/webapps/myproject/lib/python2.6/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/home/username/lib/python2.6/South-0.7.3-py2.6.egg/south/management/commands/migrate.py", line 105, in handle
ignore_ghosts = ignore_ghosts,
File "/home/username/lib/python2.6/South-0.7.3-py2.6.egg/south/migration/__init__.py", line 171, in migrate_app
applied = check_migration_histories(applied, delete_ghosts, ignore_ghosts)
File "/home/username/lib/python2.6/South-0.7.3-py2.6.egg/south/migration/__init__.py", line 88, in check_migration_histories
raise exceptions.GhostMigrations(ghosts) …Run Code Online (Sandbox Code Playgroud) 上下文: chrome浏览器扩展使用JQuery从远程django应用程序请求响应.Django认识到请求是通过AJAX进行的,并以"Hello AJAX!"响应.我的练习基于这个很好的例子.因为此请求是通过chrome扩展进行的,所以请求是跨站点进行的,所以我@CSRF_exempt在Django视图中使用了装饰器.
问题:我的Django视图没有将请求识别为AJAX请求,而是响应Hello AJAX!它而不是响应Hello not AJAX!.
我的Django视图:(
网址/xhr_test使用以下视图)
@csrf_exempt
def check_login_extension(request):
if request.is_ajax():
message = "Hello AJAX!"
else:
message = "Hello not AJAX"
return HttpResponse(message)
Run Code Online (Sandbox Code Playgroud)
我的JQuery请求:
function xhrconnect() {
$.get("http://localhost:8000/xhr_test", function(data) {
document.getElementById('xhrmsg').innerHTML = (data);
});
}
Run Code Online (Sandbox Code Playgroud) 在部署到 Heroku 的 Django 1.11 应用程序上。当加载根 URL 时/(我猜当 Django 进入模板时{% static 'angular/angular.min.js' %})homepage.html我收到以下错误:
ValueError: Missing staticfiles manifest entry for 'angular/angular.min.js'
File "django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "homepage/views.py", line 87, in homepage
"latest_python3": Version.objects.filter(supports_python3=True).select_related("package").distinct().order_by("-created")[0:5]
File "django/shortcuts.py", line 30, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "django/template/loader.py", line 68, …Run Code Online (Sandbox Code Playgroud)