![]() If you need to stop it, you can restart it again by running the command above. Leave the web server running for the rest of this tutorial. To shut down the web server, make sure the terminal window is active, then press Control-C (or the appropriate "break" key for your console). Try it now: leave the web server running, then edit hello.go to change Hello, world! to something else. As you update your source, it recompiles them and relaunches your local app. The development app server knows to watch for changes in your file. For more information about running the development web server, including how to change which port it uses, see the Development Server reference, or run goapp help serve.Test the application by visiting the following URL in your web browser: The web server is now running, listening for requests on port 8080. The application's directory structure should look like this: You can now test it with the web server included with the App Engine SDK.Ĭheck that you have everything in its right place. With the hello package and configuration file mapping every URL to the Go program, the application is complete. For a complete list of configuration options, see the Go Application Configuration page. However, you may still use the app.yaml file to configure paths that serve static files or require special permissions. This is why we call http.HandleFunc inside the init function to associate our handler with the web root ( "/"). Note: the Go SDK does things differently than the Python and Java SDKs: all Go packages for a given app are built into a single executable, and request dispatch is handled by the Go program itself. ![]() The _go_app value is a magic string recognized by the development web server it is ignored by the production App Engine servers. Every request to a URL whose path matches the regular expression /.* (all URLs) should be handled by the Go program.This code runs in the go runtime environment, with API version go1.If you adjust this before uploading new versions of your application software, App Engine will retain previous versions, and let you roll back to a previous version using the administrative console. This is version number 1 of this application's code.This value can be anything during development. When you register your application with App Engine later in this tutorial, you will select a unique identifier, and update this value. The application identifier is helloworld.This can be done by adding the following line to your $HOME/.profile, $HOME/.bashrc, or equivalent:įrom top to bottom, this configuration file says the following about this application: To simplify development and deployment, consider adding this directory to your PATH environment variable. You can find these commands in the go_appengine directory of the zip archive. ![]() goapp deploy, for uploading your app to App Engine.goapp serve, for running a local development server.If you have issues with the Python tools, please ensure you have Python 2.7 installed.ĭownload and install the App Engine SDK for Go for your operating system.įor this tutorial, you will use two commands from the goapp tool in the SDK: ![]() Most Mac OS X users already have Python 2.7 installed. If necessary, download and install Python 2.7 for your platform from the Python web site. The Go SDK uses slightly modified versions of the development tools from the Python SDK, and will run on any Intel-based Mac OS X, Linux or Windows computer with Python 2.7. The Go SDK includes a web server application that simulates the App Engine environment, including a local version of the datastore, Google Accounts, and the ability to fetch URLs and send email directly from your computer using the App Engine APIs. You develop and upload Go applications for Google App Engine using the App Engine Go software development kit (SDK). To get started developing Google App Engine applications, you download and set up the App Engine software development kit.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |