Git Product home page Git Product logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 2, 2024
This is not documented, but webapp2 doesn't include a config object by default.

You must do:

import webapp2
from webapp2_extras import config as extras_config

app_config = {}
app_config['webapp2_extras.sessions'] = {
    'secret_key': 'some-secret-key',
}

app = webapp2.WSGIAppplication([...routes...])
app.config = extras_config.Config(app_config)

I'm sorry for the trouble, and I'll add a page to the docs explaining how to 
make the config used by some of the extras modules available.

Original comment by rodrigo.moraes on 3 Jun 2011 at 6:12

  • Changed state: Accepted
  • Added labels: Component-Docs
  • Removed labels: Type-Defect

from webapp-improved.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 2, 2024
This issue was closed by revision 76b7b45014a2.

Original comment by rodrigo.moraes on 3 Jun 2011 at 6:35

  • Changed state: Fixed

from webapp-improved.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 2, 2024
As a side note, you must leave the application object outside of main():

application = webapp2.WSGIApplication([('/', 'main.MainHandler')],
                                     debug=True)

def main():
    util.run_wsgi_app(application)

This way the app is created once and not on every request.

Original comment by rodrigo.moraes on 3 Jun 2011 at 6:38

from webapp-improved.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 2, 2024
After this issue, I decided to add a simple configuration object to the WSGI 
app, which now can be initialized with a config dictionary:

app = webapp2.WSGIApplication(routes, debug=True, config={})

A full explanation and example are here:

http://webapp-improved.appspot.com/guide/extras.html

The error "'WSGIApplication' object has no attribute 'config'" will no longer 
occur, as a separate config doesn't need to be set. The sessions module, 
however, requires a secret_key to be set.

Thanks for the feedback. :)

Original comment by rodrigo.moraes on 4 Jun 2011 at 11:28

from webapp-improved.

Related Issues (20)

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.