Giter VIP home page Giter VIP logo

flask-engine's Introduction

Flask Engine


                                                           EE                   
                                                          EtjK                  
                                                          EtjG                  
                f                                         EjfLE                 
              ###                     ##                  EffLGE  KEKKE         
   #########  ###                     ##                  ELLLGDK:.:::::K       
    ##     #   ##                      #                  ELLLG,,:::LLt:,K      
    ##         ##                      #                  ELL:,,.:,Ltfjt::.     
    ##         ##                      #                  EG,,,:.:i,itttt:K     
    ##         ##                      #                  E,,,,.:;;:;.ttt::     
    ##   #     ##     ####     ####    #  #####          E,,,,,,:LLL.i;tt,,     
    ######     ##    ## .#    #   #.   #   ##           E,,,,,,::LLti,:tti,     
    ##   #     ##    t   #    ##       #  #             K,,,,,,::GGGGiitti,.    
    ##         ##        #    ###.     # ##             EKKKKE,,:GGG,,,tt,,     
    ##         ##    L## #      ###    ## ##         EEjtjLtGD:::ff;itttt,:KE   
    ##         ##   ##   #        ##   #  ##;      EDLLfiDDDDD,,::t:,;itt,DGGE  
    ##         ##   ##   #   :#   ##   #.  ##.    ,jtffLGGEE;,,,,,ittftt,,GGDf  
   ####i      f###  ########  #####   ###K  ###L   KELDEK Eii,,,,,,,jtt,,EGj    
                                                           Kj,,,,,,,,,,:E       
                                                             ED:,,,,,,ED        
                                                                jEKEt           


                      github.com/zachwill/flask-engine

Changelog

###V1.0.3

  • Renamed repo to Flask Engine
    • Run git remote set-url upstream https://github.com/zachwill/flask-engine

Sorry about any headaches this causes, but the name gae-flask-html5 had become a little too verbose. You can still git pull upstream from any changes/updates I make -- just make sure you either git remote set-url or do the following: git remote rm upstream and then git remote add upstream https://github.com/zachwill/flask-engine.

###V1.0.2

  • Minor fixes to views.py file.
  • Ajax functionality for adding todos.

###V1.0.1

  • Fixed bug with werkzeug_debugger_appengine submodule.
  • Minor changes to files (fixed grammar issues, deleted comments, etc).

V1.0

  • Added send email functionality.
    • NOTE: You'll have to update the from_address variable in views.py for it to work properly.
    • Don't forget to run the development server with the dev_appserver.py --enable_sendmail . command.
  • Added test.py file for running unittest. Deleted gaeunit.py.
    • Tests kept in tests directory.
    • Now uses GAE v1.4.3's testbed functionality.

What is this?

It's just a simple Flask skeleton for Google App Engine, but made with all the baked-in-goodness of html5 boilerplate.

I'm planning on using this for my GAE projects going forward (I really like the speed of Flask compared to Django-Nonrel on GAE), so I thought someone else might find it useful, too.

Just about everything is ready to go right out of the box -- including QUnit for JavaScript tests and a tests directory for Python's unittest. Also, I included a style.less file since I primarily only use the Less.app when writing stylesheets nowadays.

Why should I use it?

I stumbled a bit figuring out how to add tests and use the unittest module, and also setup an appengine_console.py file to connect to GAE's remote API, so this skeleton might come in handy for you.

I looked at two other Flask GAE skeletons on Github (flask-gae-skeleton and flask-gae-template -- both of which were awesome for learning), and I adapted what I felt were some of their best parts. Recently, I've updated this project's structure after browsing the source code of another GAE project skeleton.

Lastly, as an added bonus, the scripts are PEP8 compliant.

How do I use it?

Make sure you have the Google App Engine SDK installed on your computer, and you've created an application for your Google account. The SDK will also install symlinks to its packages on your computer.

Steps to Get Up and Running

  1. Create a new application on Google App Engine.

  2. git clone this repo into your personal project folder.

  3. Amend the app.yaml file with your application's name.

  4. Run the project from your development server (use the dev_appserver.py . command or use the Google App Engine Launcher GUI).

  5. Browse the sample application in your web browser: http://localhost:8080

  6. Once you're ready to read the source code, check out the app directory.

  7. All static media is stored in the static directory.

    • This includes your favicon, robots.txt, and humans.txt
  8. Before you deploy, don't forget to:

    • Update the humans.txt file.
    • Uncomment the default_expiration in app.yaml
    • Change the SECRET_KEY in settings.py using Python's os.urandom function.

    >>> import os
    >>> os.urandom(24)
    '\xfd{H\xe5<\x95\xf9\xe3\x96.5\xd1\x01O

Useful Commands

Setup

git clone https://github.com/zachwill/flask-engine.git <your_app_name_here>

Run

dev_appserver.py .

If you're planning on using email functionality with the development server, use the following command:

dev_appserver.py --enable_sendmail .

Deploy

appcfg.py update .

Test

Tests are written using GAE v1.4.3's testbed functionality. Currently, there is a known bug for users without PIL installed.

python test.py

Remote Console

python appengine_console.py <your_app_name_here>

Todo

  • add more tests
  • add pep8.py to libs
    • create PEP8 TestCase, too

License

Author: Zach Williams

All of my code is released under the Unlicense (a.k.a. Public Domain).

flask-engine's People

Contributors

dominicphillips avatar lgastako avatar roasbeef avatar zachwill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flask-engine's Issues

Stacktrace at /todo/

The link http://localhost:8080/todo/ shows a stacktrace:

Traceback (most recent call last):

  File "/home/ondrej/repos/flask-engine/libs/flask/app.py", line 1701, in __call__
    return self.wsgi_app(environ, start_response)

  File "/home/ondrej/repos/flask-engine/libs/flask/app.py", line 1689, in wsgi_app
    response = self.make_response(self.handle_exception(e))

  File "/home/ondrej/repos/flask-engine/libs/flask/app.py", line 1687, in wsgi_app
    response = self.full_dispatch_request()

  File "/home/ondrej/repos/flask-engine/libs/flask/app.py", line 1360, in full_dispatch_request
    rv = self.handle_user_exception(e)

  File "/home/ondrej/repos/flask-engine/libs/flask/app.py", line 1358, in full_dispatch_request
    rv = self.dispatch_request()

  File "/home/ondrej/repos/flask-engine/libs/flask/app.py", line 1344, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)

  File "/home/ondrej/repos/flask-engine/app/views.py", line 28, in todo_list
    return render_template('todo.html', form=form, todos=todos)

  File "/home/ondrej/repos/flask-engine/libs/flask/templating.py", line 125, in render_template
    context, ctx.app)

  File "/home/ondrej/repos/flask-engine/libs/flask/templating.py", line 107, in _render
    rv = template.render(context)

  File "/home/ondrej/repos/flask-engine/libs/jinja2/environment.py", line 891, in render
    return self.environment.handle_exception(exc_info, True)

  File "/home/ondrej/repos/flask-engine/app/templates/todo.html", line 1, in top-level template code
    {% extends "base.html" %}

BuildError: ('add_todo', {}, None)

OSX + virtualenv = missing inspect?

I realize this is a bit nebulous and undermapped, but I get:

File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2318, in LoadModuleRestricted
description)
File "/Users/gregg/gits/flask-engine/libs/werkzeug/_internal.py", line 11, in
import inspect
ImportError: No module named inspect

Details:

Py27 OR Py25, running through virtualenv.

venv: $ mkvirtualenv gae --no-site-packages --distribute --python /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python

Running using system python (on OSX) goes fine.

(note: I am new to GAE, so I might be ignorant here!)

Suggested fix: notes in readme?

Error

I follow the instructions (I think), and I get this: "BuildError: ('views.index', {}, None)"

flaskext.wtf library not working properly

Installed flaskext.wtf and wtforms on another branch. Ran into errors.

I'm assuming this has to do with the nonexistant pkg_resources file, and I'm sure the libraries aren't looking in libs folder for dependencies.

Beginning to wonder if it has to do with flask.current_app?

ImportError: No module named gae_path.util

When I try and run the tests I get this error

Traceback (most recent call last):
File "test.py", line 7, in
find_gae_sdk()
File "/my/local/path/api/utils.py", line 28, in find_gae_sdk
from gae_path.util import gae_sdk_path, add_gae_sdk_path
ImportError: No module named gae_path.util

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.