English 中文(简体)
经营 d果-皮石块时的就业情况
原标题:Empty docstrings when running django-piston docs under nginx

我用django-piston为我的REST json api,而且我已经通过在产生思想功能方面建造的笔记来编制文件。 在django经营服务器下,它发挥了巨大作用。 试射物体的模板成功地列出了该类别和每种方法的示意图。

当我通过 n子和uwsgi为这个地点服务时,这种铺设是空洞的。 我首先认为,这是 d木标记过滤器和采用经过调整的文字编排格式的一个问题,但当我转而去,只是试图在模板中看到原始标识值时,这些数值是没有的。

我看不出这些记录中的任何问题,我无法理解为什么 n子/u子是这里的因素,但坦率地说,这在dev子的管理人身上是巨大的。 我 kind着如何开始通过 n子/u子来抓。 是否有任何人陷入这种局面,或建议我可以开始研究什么地方?

我的看法非常简单:

<>views.py

def ApiDoc(request):
    docs = [
        generate_doc(handlers.UsersHandler),
        generate_doc(handlers.CategoryHandler),
    ]

    c = {
         docs : docs,
         model :  Users 
    }

    return render_to_response("api/docs.html", c, RequestContext(request))

我的模板几乎与存货表格式相同:

api/docs.html>

{% load markup %}

...

    {% for doc in docs %}

        <h5><a href="#top">top</a></h5>
        <h3><a id="{{doc.name}}">{{ doc.name|cut:"Handler" }}:</a></h3>

        <p>
            {{ doc.doc|default:""|restructuredtext }}
        </p>
...
        {% for method in doc.get_all_methods %}

            {% if method.http_name in doc.allowed_methods %}

            <dt><a id="{{doc.name}}_{{method.http_name}}">request</a> <i>{{ method.http_name }}</i></dt>                

            {% if method.doc %}
                <dd>
                    {{ method.doc|default:""|restructuredtext }}
                <dd>
            {% endif %}

该模板在正文中得出的结果是doc.docmethod.doc/code>无。 我已尝试取消过滤器,只是检查原材料,以证实这一点。

我猜想这个问题,在乌韦西人层及其环境中一定会存在。 like:

<>strong>/etc/init/uwsgi.conf

description "uWSGI starter"
start on (local-filesystems
and runlevel [2345])
stop on runlevel [016]
respawn
exec /usr/sbin/uwsgi 
--uid www-data 
--socket /opt/run/uwsgi.sock 
--master 
--logto /opt/log/uwsgi_access.log 
--logdate 
--optimize 2 
--processes 4 
--harakiri 120 
--post-buffering 8192 
--buffer-size 8192 
--vhost 
--no-site

我的原始服务器入口处也这样看:

sites-enabled/mysite.com>

server {
    listen 80;
    server_name www.mysite.com mysite.com;

    set $home   /var/www/mysite.com/projects/mysite;
    set $pyhome /var/www/mysite.com/env/mysite;

    root $home;
...
    location ~ ^/(admin|api)/ {
        include uwsgi_params;
        uwsgi_pass uwsgi_main;

        uwsgi_param UWSGI_CHDIR $home;
        uwsgi_param UWSGI_SCRIPT wsgi_app;
        uwsgi_param UWSGI_PYHOME $pyhome;

        expires epoch;
    }
...
}

<>Edit: 配置信息

  • Server: Ubuntu 11.04
  • uWSGI version 1.0
  • nginx version: nginx/1.0.11
  • django non-rel 1.3.1
  • django-piston latest pypi 0.2.3
  • python 2.7
最佳回答

育空观测组正在以相当于SOO选择的同样方式开始部署口译人员,以指挥线。 二级优化排除了剂量。

-OO    : remove doc-strings in addition to the -O optimizations

Change:

--optimize 2

:

--optimize 1
问题回答

暂无回答




相关问题
How to get two random records with Django

How do I get two distinct random records using Django? I ve seen questions about how to get one but I need to get two random records and they must differ.

Moving (very old) Zope/Plone Site to Django

I am ask to move data from a (now offline) site driven by Plone to a new Django site. These are the version informations I have: Zope Version (unreleased version, python 2.1.3 ) Python Version 2.1....

Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

Flexible pagination in Django

I d like to implement pagination such that I can allow the user to choose the number of records per page such as 10, 25, 50 etc. How should I go about this? Is there an app I can add onto my project ...

is it convenient to urlencode all next parameters? - django

While writing code, it is pretty common to request a page with an appended "next" query string argument. For instance, in the following template code next points back to the page the user is on: &...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...