WebFaction
Community site: login faq

I'm deploying a Flask project on Webfaction and have an odd problem. I can't display any Jinja2 template where is a form that written with WTForms. So, I got an 500 error instead of any page that has something like that:

<form method="post" action="/">
   {{ form.hidden_tag() }}
   {{ form.last_name }}
   {{ form.name }}
</forms>

All static data working good with {{ ... }} in any template. Also it doesn't matter if I pass form from views or pass only a template that include my form fields as {{ ... }}.

# View.
@main.route('/')
def view():
   return render_template('index.html')

or

# View.
@main.route('/')
def view():
   form = MyForm()
   return render_template('index.html', form=form)

On my local machine the project works fine. All forms are displayed correctly and also send valid data to the db.

There are no errors in log files on Webfaction.

I have no ideas why does that happen.

Thank you.

asked 28 Dec '13, 07:52

kuyn
111
accept rate: 0%


Hello,

First of all, you need to enable debugging information for your Flask app. You can do this by adding this line into your WSGI script:

application.debug = True

I already did this for you, and I now see a large number of exceptions printed to your error log file, located at ~/logs/user/error_APPNAME.log. To summarize, it looks like you misspelled "models" ("modelss"), and this is causing a cascade effect, triggering other errors such as this:

TypeError: unbound method hidden_tag() must be called with OfferFormExtended instance as first argument (got nothing instead)

So, to fix this problem, fix your spelling error, restart your Flask app, and debug from there.

Regards,

~Christopher S, WebFaction Support

permanent link

answered 28 Dec '13, 13:00

likebike
3366
accept rate: 28%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×62
×44
×1

question asked: 28 Dec '13, 07:52

question was seen: 3,272 times

last updated: 28 Dec '13, 13:00

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM