django-autocomplete-light在apache中不起作用

时间:2016-06-18 06:19:40

标签: django-autocomplete-light

我正在使用django-autocomplete-light

Django==1.8
django-autocomplete-light==3.1.6
django-easy-select2==1.2.5
django-suit==0.2.13
django-tables2==1.0.4

当我在django开发服务器中运行它时工作正常,但是当我设置DEBUG = False并在apache中运行应用程序时它没有加载。 我已经运行了collectstatic和select2 javscript并且css存在并且可以下载。 该页面显示 select2不是函数的javscript错误。

settings.py

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'suit',
    'myapp',
    'dal',
    'dal_select2',
    'django.contrib.admin',
    'django_extensions',
    'simple_history',
    'django_tables2',
    'django.contrib.admindocs',
    'rest_framework',
    'rest_framework.authtoken',
)

内容管理页面顺序:

<link href="/static/autocomplete_light/vendor/select2/dist/css/select2.css" type="text/css" media="all" rel="stylesheet" />
<link href="/static/autocomplete_light/select2.css" type="text/css" media="all" rel="stylesheet" />
<script type="text/javascript" src="/static/admin/js/core.js"></script>
<script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
<script type="text/javascript" src="/static/admin/js/actions.min.js"></script>
<script type="text/javascript" src="/static/autocomplete_light/jquery.init.js"></script>
<script type="text/javascript" src="/static/autocomplete_light/autocomplete.init.js"></script>
<script type="text/javascript" src="/static/autocomplete_light/vendor/select2/dist/js/select2.full.js"></script>
<script type="text/javascript" src="/static/autocomplete_light/select2.js"></script>
<script type="text/javascript" src="/static/admin/js/related-widget-wrapper.js"></script>
<script type="text/javascript" src="/static/admin/js/calendar.js"></script>
<script type="text/javascript" src="/static/admin/js/admin/DateTimeShortcuts.js"></script>

1 个答案:

答案 0 :(得分:1)

这很奇怪。在花了很多精力玩这个之后,我清除了静态文件夹内容并从头开始运行collectstatic django命令并且它现在正在工作。当我区分它时,我发现admin和select2.js有变化,所以他们可能已经更新了包以解决问题。