Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7090943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:07:09+00:00 2026-05-28T08:07:09+00:00

I’m using django-piston for my REST json api, and I have it all set

  • 0

I’m using django-piston for my REST json api, and I have it all set up for documentation through pistons built in generate_doc function. Under the django runserver, it works great. The template that loops over the doc objects successfully lists the docstrings for both the class and for each method.

When I serve the site via nginx and uwsgi, the docstrings are empty. At first I thought this was a problem with the django markup filter and using restructuredtext formatting, but when I turned that off and just simply tried to see the raw docstring values in the template, they are None.

I don’t see any issues in the logs, and I can’t understand why nginx/uwsgi is the factor here, but honestly it does work great over the dev runserver. I’m kind of stuck on how to start debugging this through nginx/uwsgi. Has anyone run into this situation or have a suggestion of where I can start to look?

My doc view is pretty simple:

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))

And my template is almost identical to the stock piston template:

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 %}

The rendered result of this template under nginx would be that doc.doc and method.doc are None. I have tried removing the filter and just checking the raw value to confirm this.

I’m guessing the problem would have to be somewhere in the uwsgi layer, and its environment. Im running uwsgi with a config like this:

/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

And my nginx server entry location snippet looks like this:

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: Configuration Info

  • 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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:07:10+00:00Added an answer on May 28, 2026 at 8:07 am

    uWSGI is starting up the interpreter in way equivalent to -OO option to Python command line. This second level of optimisation removes doc strings.

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

    Change:

    --optimize 2
    

    to:

    --optimize 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to loop through a bunch of documents I have to put
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.