Code Monkey home page Code Monkey logo

appengine-python-morepath-skeleton's Introduction

Python Morepath Skeleton for Google App Engine

A skeleton for building Python applications on Google App Engine with the Morepath framework.

Run Locally

  1. Install the App Engine Python SDK. See the README file for directions. You'll need python 2.7 and pip 1.4 or later installed too.

  2. Clone this repo with

    git clone https://github.com/webmaven/appengine-python-morepath-skeleton.git
    
  3. Install dependencies in the project's lib directory. Note: App Engine can only import libraries from inside your project directory.

    cd appengine-python-morepath-skeleton
    pip install -r requirements.txt -t lib
    
  4. Run this project locally from the command line:

    dev_appserver.py .
    

Visit the application http://localhost:8080

See the development server documentation for options when running dev_appserver.

Deploy

To deploy the application:

  1. Use the Admin Console to create a project/app id. (App id and project id are identical)

  2. Deploy the application with

    appcfg.py -A <your-project-id> --oauth2 update .
    
  3. Congratulations! Your application is now live at your-app-id.appspot.com

Next Steps

This skeleton includes TODO markers to help you find basic areas you will want to customize.

Relational Databases and Datastore

To add persistence to your models, use NDB for scale. Consider CloudSQL if you need a relational database.

Installing Libraries

See the Third party libraries page for libraries that are already included in the SDK. To include SDK libraries, add them in your app.yaml file. Other than libraries included in the SDK, only pure python libraries may be added to an App Engine project.

Feedback

Star this repo if you found it useful. Use the github issue tracker to give feedback on this repo.

Licensing

See LICENSE

Author

Michael R. Bernstein

Bitdeli Badge

appengine-python-morepath-skeleton's People

Contributors

bitdeli-chef avatar webmaven avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

peterkinalex

appengine-python-morepath-skeleton's Issues

Code not compatible with Morepath 0.7

@faassen, simply upgrading this 'Hello World' example to Morepath 0.7 (in requirements.txt) breaks it with the following:

ERROR    2014-11-16 20:26:57,068 wsgi.py:263] 
Traceback (most recent call last):
  File "/home/webmaven/projects/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/home/webmaven/projects/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/home/webmaven/projects/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/home/webmaven/projects/appengine-python-morepath-skeleton/main.py", line 4, in <module>
    import morepath
  File "/home/webmaven/projects/appengine-python-morepath-skeleton/lib/morepath/__init__.py", line 2, in <module>
    from .app import App
  File "/home/webmaven/projects/appengine-python-morepath-skeleton/lib/morepath/app.py", line 2, in <module>
    from morepath import generic
  File "/home/webmaven/projects/appengine-python-morepath-skeleton/lib/morepath/generic.py", line 4, in <module>
    @reg.generic
AttributeError: 'module' object has no attribute 'generic'
DEBUG: Handled logservice.Flush in 0.0004
DEBUG: Request handled by <Instance 00bdc6dbfdeb8b9e328accd167dc96ffb49a: 1/8, total: 1> in 0.0206s
INFO: default: "GET / HTTP/1.1" 500 -

It isn't obvious to me which changes listed for 0.7 in CHANGES.txt are responsible.

'Hello World' not working

Running this app and loading localhost:8080 produces an error:

ERROR    2014-07-09 23:19:42,702 wsgi.py:278] 
Traceback (most recent call last):
  File "/home/webmaven/projects/google_appengine/google/appengine/runtime/wsgi.py", line 266, in Handle
    result = handler(dict(self._environ), self._StartResponse)
  File "/home/webmaven/.virtualenvs/mpath-gae/appengine-python-morepath-skeleton-master/lib/morepath/app.py", line 130, in __call__
    return self._app_mount(environ, start_response)
  File "/home/webmaven/.virtualenvs/mpath-gae/appengine-python-morepath-skeleton-master/lib/morepath/mount.py", line 35, in __call__
    response = self.app.publish(request)
  File "/home/webmaven/.virtualenvs/mpath-gae/appengine-python-morepath-skeleton-master/lib/morepath/publish.py", line 68, in publish
    return resolve_response(request, model)
  File "/home/webmaven/.virtualenvs/mpath-gae/appengine-python-morepath-skeleton-master/lib/morepath/publish.py", line 50, in resolve_response
    raise HTTPNotFound()
HTTPNotFound: The resource could not be found.
INFO     2014-07-09 23:19:43,596 module.py:639] default: "GET / HTTP/1.1" 500 -

App cannot import repoze.lru

When the app is run locally, the repoze.lru library cannot be imported, and we get the following traceback:

ERROR    2014-07-06 20:57:30,441 wsgi.py:262] 
Traceback (most recent call last):
  File "/home/webmaven/projects/google_appengine/google/appengine/runtime/wsgi.py", line 239, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/home/webmaven/projects/google_appengine/google/appengine/runtime/wsgi.py", line 298, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/home/webmaven/projects/google_appengine/google/appengine/runtime/wsgi.py", line 84, in LoadObject
    obj = __import__(path[0])
  File "/home/webmaven/.virtualenvs/mpath-gae/appengine-python-morepath-skeleton-master/main.py", line 4, in <module>
    import morepath
  File "/home/webmaven/.virtualenvs/mpath-gae/appengine-python-morepath-skeleton-master/lib/morepath/__init__.py", line 2, in <module>
    from .app import App, AppBase, global_app, enable_implicit, disable_implicit
  File "/home/webmaven/.virtualenvs/mpath-gae/appengine-python-morepath-skeleton-master/lib/morepath/app.py", line 1, in <module>
    from .mount import Mount
  File "/home/webmaven/.virtualenvs/mpath-gae/appengine-python-morepath-skeleton-master/lib/morepath/mount.py", line 1, in <module>
    from .path import register_path, get_arguments, SPECIAL_ARGUMENTS
  File "/home/webmaven/.virtualenvs/mpath-gae/appengine-python-morepath-skeleton-master/lib/morepath/path.py", line 1, in <module>
    from morepath import generic
  File "/home/webmaven/.virtualenvs/mpath-gae/appengine-python-morepath-skeleton-master/lib/morepath/generic.py", line 1, in <module>
    import reg
  File "/home/webmaven/.virtualenvs/mpath-gae/appengine-python-morepath-skeleton-master/lib/reg/__init__.py", line 6, in <module>
    from .predicate import (PredicateRegistry, Predicate, KeyIndex,
  File "/home/webmaven/.virtualenvs/mpath-gae/appengine-python-morepath-skeleton-master/lib/reg/predicate.py", line 4, in <module>
    from repoze.lru import lru_cache
ImportError: No module named repoze.lru
INFO     2014-07-06 20:57:30,451 module.py:639] default: "GET / HTTP/1.1" 500 -

lib directory missing

with a README.md w/ the following content

This directory contains third-party dependencies installed with `pip`.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.