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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:13:40+00:00 2026-06-10T00:13:40+00:00

My flask application currently consists of a single test.py file with multiple routes and

  • 0

My flask application currently consists of a single test.py file with multiple routes and the main() route defined. Is there some way I could create a test2.py file that contains routes that were not handled in test.py?

@app.route('/somepath')
def somehandler():
    # Handler code here

I am concerned that there are too many routes in test.py and would like to make it such that I can run python test.py, which will also pick up the routes on test.py as if it were part of the same file. What changes to I have to make in test.py and/or include in test2.py to get this to work?

  • 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-10T00:13:42+00:00Added an answer on June 10, 2026 at 12:13 am

    You can use the usual Python package structure to divide your App into multiple modules, see the Flask docs.

    However,

    Flask uses a concept of blueprints for making application components and supporting common patterns within an application or across applications.

    You can create a sub-component of your app as a Blueprint in a separate file:

    simple_page = Blueprint('simple_page', __name__, template_folder='templates')
    @simple_page.route('/<page>')
    def show(page):
        # stuff
    

    And then use it in the main part:

    from yourapplication.simple_page import simple_page
    
    app = Flask(__name__)
    app.register_blueprint(simple_page)
    

    Blueprints can also bundle specific resources: templates or static files. Please refer to the Flask docs for all the details.

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

Sidebar

Related Questions

I have a mp4 file which is to be used in an application. Currently
I'm starting new Google App Engine application and currently considering two frameworks: Flask and
We have implemented charting functionality in our Oracle APEX application using AnyChart. Currently there
I am programming a little software prototype as Flash/Actionscript3 application. Currently I registered some
My Flash (AS3/AIR) application is currently using a slightly unusual architecture (for a Flash
Currently, I'm trying to develop a rich internet application using Flash Builder 4 Beta
Currently I'm allowed users to add application/x-shockwave-flash objects to their profiles in my website.
I'm trying to push a Flask application into Heroku. But if i start the
I am creating a fairly large application using Flask and Jinja. Flask recommends separating
With Python web application frameworks such as Flask, webapp2 and Pyramid, how can each

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.