Skip to content

Step 0 create an empty project

opensas edited this page Sep 12, 2011 · 9 revisions

Step 0 - create an empty project

Purpose: the purpose of this step is to show you how to create a new app with play and to explain the general structure of a play application.

Creating your first play app

Go to you applications directory and run play new play-demo to create the play-demo app

cd ~/devel/apps
play new play-demo
~        _            _ 
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/   
~
~ play! 1.2.3, http://www.playframework.org
~
~ The new application will be created in /home/sas/Dropbox/Public/devel/play/apps/play-demo
~ What is the application name? [play-demo] 

here you just just press enter, and you'll see something the following message

~
~ OK, the application is created.
~ Start it with : play run play-demo
~ Have fun!
~

Running the app

Go ahead and type

play run play-demo

And believe it or not your application is up and running, with everything set up to begin to add functionality to it. Got check for yourself, open a browser and go to http://localhost:9000

You'll see play's welcome page. From this page you also have local access to play's documentation at http://localhost:9000/@documentation and to the API javadocs at http://localhost:9000/@api

Having a look at a play app

When you run play new [app] command play generates a basic application structure like this

app
  models
  controllers
    Application.java
  views
    main.html
    Application
      index.html
lib
test
  Application.test.html
  ApplicationTest.java
  BasicTest.java
  data.yml
conf
  application.conf
  routes
  dependencies.yml
public
  stylesheets
  javascripts
  images

Now you can move on to Step 1 - my first controller