1

I have a fresh install of django-tastypie and django-tastypie-swagger.

http://localhost:8000/tasty/doc/ serves the necessary HTML, but doesn't pull in any of the CSS or JS that's needed to make it work.

http://localhost:8000/tasty/doc/resources/ works and shows:

{
    basePath: "http://localhost:8000/tasty/doc/schema/",
    apis: [
        {
            path: "/snap"
        },
        {
            path: "/user"
        }
    ],
    apiVersion: "0.1",
    swaggerVersion: "1.1"
}

But all the others (/schema/ and the static files) return 404 errors.

4

3 回答 3

0

For anyone who encounter this problem in the future ... you might want to perform the following command after installing django-tastypie

python manage.py collectstatic --noinput
于 2015-01-05T23:47:59.460 回答
0

我遇到了同样的问题,并通过在以下路径上的项目模板目录下创建一个文件来解决它:templates/tastypie_swagger,其中包含此文件的内容:

请注意,问题是由STATIC_URL变量引起的,这是被误解的,我用我的项目 url 替换了该变量,它工作得很好。

于 2014-01-24T19:11:13.867 回答
0

我有同样的问题。简单修复在settings.py中将“ django.core.context_processors.static ”添加到“ context_processors ” 。比STATIC_URL 更有效。

于 2015-10-09T13:46:16.670 回答