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 9040287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:57:08+00:00 2026-06-16T09:57:08+00:00

I am using Flask to develop a python app. At the moment, I want

  • 0

I am using Flask to develop a python app. At the moment, I want this app to be run locally. It runs locally fine through python, but when I use cx_freeze to turn it into an exe for Windows, I can no longer use the Flask.render_template() method. The moment I try to execute a render_template, I get an http 500 error, exactly as if the html template I’m trying to render does not exist.

The main python file is called index.py. At first I tried to run: cxfreeze index.py. This did not include the “templates” directory from the Flask project in the cxfreeze “dist” directory. So then I tried using this setup.py script and running python setup.py build. This now includes the templates folder and the index.html template, but I still get the http: 500 error when it tries to render the template.

from cx_Freeze import setup,Executable

includefiles = [ 'templates\index.html']
includes = []
excludes = ['Tkinter']

setup(
name = 'index',
version = '0.1',
description = 'membership app',
author = 'Me',
author_email = 'me@me.com',
options = {'build_exe': {'excludes':excludes,'include_files':includefiles}}, 
executables = [Executable('index.py')]
)

Here is an example method from the script:

@app.route('/index', methods=['GET'])
def index():
    print "rendering index"
    return render_template("index.html")

If I run index.py then in the console I get:

 * Running on http://0.0.0.0:5000/
 rendering index
 127.0.0.1 - - [26/Dec/2012 15:26:41] "GET / HTTP/1.1" 200 -
 127.0.0.1 - - [26/Dec/2012 15:26:42] "GET /favicon.ico HTTP/1.1" 404 -

and the page is displayed correctly in my browser, but if I run index.exe, I get

 * Running on http://0.0.0.0:5000/
rendering index
127.0.0.1 - - [26/Dec/2012 15:30:57] "GET / HTTP/1.1" 500 -
127.0.0.1 - - [26/Dec/2012 15:30:57] "GET /favicon.ico HTTP/1.1" 404 -

and

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

in my browser.

If I return raw html, e.g.

@app.route('/index', methods=['GET'])
def index():
    print "rendering index"
    return "This works"

then it works fine. So a possible work around is to stop using Flask’s templates and hardcode all the html logic into the main python file. This gets very messy though, so I’d like to avoid it if possible.

I’m using Python 2.7 32-bit, Cx_freeze for Python 2.7 32-bit, and Flask 0.9

Thanks for any help and ideas!

  • 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-06-16T09:57:09+00:00Added an answer on June 16, 2026 at 9:57 am

    After many false trails trawling through the Flask and Jinga modules, I finally found the problem.

    CXFreeze does not recognize that jinja2.ext is a dependency, and was not including it.

    I fixed this by including import jinja2.ext in one of the python files.

    CXFreeze then added ext.pyc to library.zip\jinja. (Copying it in manually after the build also works)

    Just in case anyone else is mad enough to try use Flask to develop locally run apps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using the python framework flask with sqlalchemy. My many-to-many looks like this: collections_questions
I've develop a chat server using Twisted framework in Python. It works fine with
I'm developing a fairly straightforward web app using Flask and MySQL. I'm struggling with
I develop a FB app using Flash using wmode=direct (for 3D graphics). In Internet
I am trying to develop a live video chat app using flash and rtmfp
I am using the Adobe AIR SDK to develop an HTML/JavaScript app that needs
Currently, I'm trying to develop a rich internet application using Flash Builder 4 Beta
I simply want to popup an Alertbox in AS3. I am using Flashdevelop and
I hope I can explain this properly. I'm using flashDevelop for an avatar creation
I'm using flask-sqlalchemy to build a webapp and I have the following model(s): class

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.