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

  • Home
  • SEARCH
  • 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 9212947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:38:20+00:00 2026-06-18T01:38:20+00:00

From within a Play 2.1 application, how would I programmatically determine which mode the

  • 0

From within a Play 2.1 application, how would I programmatically determine which mode the application is running in (i.e., Development vs. Production)?

For example, it would be useful to be able to do something like this from inside a template:

<p>@if(__some_play_API_call__ == Dev) { <b>Development mode</b> }</p>

In the Play 2.0 API documentation, there appears to be a mode property of the play.api.Application class… however, I am unsure about how to get at the instance of the currently running application.

  • 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-18T01:38:21+00:00Added an answer on June 18, 2026 at 1:38 am

    You can access the current Appliction via

    play.api.Play.current()
    

    to find out the mode try

    play.api.Play.current().mode()
    

    or simply use

    play.api.Play.isDev(play.api.Play.current())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PROBLEM: When I'm working with a Scala Play 2.0.4 application from within IntelliJ IDEA
I have a requirement to play YouTube video content from within an Android application
From within a webmethod (.net asmx file) - is it possible to determine from
How do I log from within my web application deployed on Tomcat 6? Where
Long ago I have learned sql and within the last years of application development
Possible Duplicate: How to know an application is installed from google play or side-load?
How can I call a controller method from within a Play! template? I have
I've setup my Play Framework 1.2.1 project to run from within IntelliJ using the
We have a Play (1.2.4) application which is auto-tested via our Teamcity server. The
I want to produce an auto updating application thats running within the tomcat server.

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.