From c498c67ed6bd18be1d54f884099df10b1db06509 Mon Sep 17 00:00:00 2001 From: Luke Macken Date: Thu, 17 Jan 2008 11:13:22 -0500 Subject: Initial `tg-admin quickstart` of funcweb --- funcweb/README.txt | 4 + funcweb/dev.cfg | 66 ++++++++++ funcweb/funcweb.egg-info/PKG-INFO | 15 +++ funcweb/funcweb.egg-info/SOURCES.txt | 21 ++++ funcweb/funcweb.egg-info/dependency_links.txt | 1 + funcweb/funcweb.egg-info/not-zip-safe | 1 + funcweb/funcweb.egg-info/paster_plugins.txt | 2 + funcweb/funcweb.egg-info/requires.txt | 1 + funcweb/funcweb.egg-info/sqlobject.txt | 2 + funcweb/funcweb.egg-info/top_level.txt | 1 + funcweb/funcweb/__init__.py | 0 funcweb/funcweb/config/__init__.py | 0 funcweb/funcweb/config/app.cfg | 52 ++++++++ funcweb/funcweb/config/log.cfg | 29 +++++ funcweb/funcweb/controllers.py | 12 ++ funcweb/funcweb/json.py | 10 ++ funcweb/funcweb/model.py | 9 ++ funcweb/funcweb/release.py | 14 +++ funcweb/funcweb/static/css/style.css | 134 +++++++++++++++++++++ funcweb/funcweb/static/images/favicon.ico | Bin 0 -> 1081 bytes funcweb/funcweb/static/images/header_inner.png | Bin 0 -> 37537 bytes funcweb/funcweb/static/images/info.png | Bin 0 -> 2889 bytes funcweb/funcweb/static/images/ok.png | Bin 0 -> 25753 bytes .../funcweb/static/images/tg_under_the_hood.png | Bin 0 -> 4010 bytes .../funcweb/static/images/under_the_hood_blue.png | Bin 0 -> 2667 bytes funcweb/funcweb/templates/__init__.py | 0 funcweb/funcweb/templates/login.kid | 114 ++++++++++++++++++ funcweb/funcweb/templates/master.kid | 47 ++++++++ funcweb/funcweb/templates/welcome.kid | 47 ++++++++ funcweb/funcweb/tests/__init__.py | 0 funcweb/funcweb/tests/test_controllers.py | 32 +++++ funcweb/funcweb/tests/test_model.py | 22 ++++ funcweb/sample-prod.cfg | 84 +++++++++++++ funcweb/setup.py | 69 +++++++++++ funcweb/start-funcweb.py | 25 ++++ funcweb/test.cfg | 4 + 36 files changed, 818 insertions(+) create mode 100644 funcweb/README.txt create mode 100644 funcweb/dev.cfg create mode 100644 funcweb/funcweb.egg-info/PKG-INFO create mode 100644 funcweb/funcweb.egg-info/SOURCES.txt create mode 100644 funcweb/funcweb.egg-info/dependency_links.txt create mode 100644 funcweb/funcweb.egg-info/not-zip-safe create mode 100644 funcweb/funcweb.egg-info/paster_plugins.txt create mode 100644 funcweb/funcweb.egg-info/requires.txt create mode 100644 funcweb/funcweb.egg-info/sqlobject.txt create mode 100644 funcweb/funcweb.egg-info/top_level.txt create mode 100644 funcweb/funcweb/__init__.py create mode 100644 funcweb/funcweb/config/__init__.py create mode 100644 funcweb/funcweb/config/app.cfg create mode 100644 funcweb/funcweb/config/log.cfg create mode 100644 funcweb/funcweb/controllers.py create mode 100644 funcweb/funcweb/json.py create mode 100644 funcweb/funcweb/model.py create mode 100644 funcweb/funcweb/release.py create mode 100644 funcweb/funcweb/static/css/style.css create mode 100644 funcweb/funcweb/static/images/favicon.ico create mode 100644 funcweb/funcweb/static/images/header_inner.png create mode 100644 funcweb/funcweb/static/images/info.png create mode 100644 funcweb/funcweb/static/images/ok.png create mode 100644 funcweb/funcweb/static/images/tg_under_the_hood.png create mode 100644 funcweb/funcweb/static/images/under_the_hood_blue.png create mode 100644 funcweb/funcweb/templates/__init__.py create mode 100644 funcweb/funcweb/templates/login.kid create mode 100644 funcweb/funcweb/templates/master.kid create mode 100644 funcweb/funcweb/templates/welcome.kid create mode 100644 funcweb/funcweb/tests/__init__.py create mode 100644 funcweb/funcweb/tests/test_controllers.py create mode 100644 funcweb/funcweb/tests/test_model.py create mode 100644 funcweb/sample-prod.cfg create mode 100644 funcweb/setup.py create mode 100755 funcweb/start-funcweb.py create mode 100644 funcweb/test.cfg (limited to 'funcweb') diff --git a/funcweb/README.txt b/funcweb/README.txt new file mode 100644 index 0000000..36f4928 --- /dev/null +++ b/funcweb/README.txt @@ -0,0 +1,4 @@ +funcweb + +This is a TurboGears (http://www.turbogears.org) project. It can be +started by running the start-funcweb.py script. \ No newline at end of file diff --git a/funcweb/dev.cfg b/funcweb/dev.cfg new file mode 100644 index 0000000..77efc8c --- /dev/null +++ b/funcweb/dev.cfg @@ -0,0 +1,66 @@ +[global] +# This is where all of your settings go for your development environment +# Settings that are the same for both development and production +# (such as template engine, encodings, etc.) all go in +# funcweb/config/app.cfg + +# DATABASE + +# pick the form for your database +# sqlobject.dburi="postgres://username@hostname/databasename" +# sqlobject.dburi="mysql://username:password@hostname:port/databasename" +# sqlobject.dburi="sqlite:///file_name_and_path" + +# If you have sqlite, here's a simple default to get you started +# in development +sqlobject.dburi="sqlite://%(current_dir_uri)s/devdata.sqlite" + + +# if you are using a database or table type without transactions +# (MySQL default, for example), you should turn off transactions +# by prepending notrans_ on the uri +# sqlobject.dburi="notrans_mysql://username:password@hostname:port/databasename" + +# for Windows users, sqlite URIs look like: +# sqlobject.dburi="sqlite:///drive_letter:/path/to/file" + +# SERVER + +# Some server parameters that you may want to tweak +# server.socket_port=8080 + +# Enable the debug output at the end on pages. +# log_debug_info_filter.on = False + +server.environment="development" +autoreload.package="funcweb" + +# Auto-Reload after code modification +# autoreload.on = True + +# Set to True if you'd like to abort execution if a controller gets an +# unexpected parameter. False by default +tg.strict_parameters = True + +# LOGGING +# Logging configuration generally follows the style of the standard +# Python logging module configuration. Note that when specifying +# log format messages, you need to use *() for formatting variables. +# Deployment independent log configuration is in funcweb/config/log.cfg +[logging] + +[[loggers]] +[[[funcweb]]] +level='DEBUG' +qualname='funcweb' +handlers=['debug_out'] + +[[[allinfo]]] +level='INFO' +handlers=['debug_out'] + +[[[access]]] +level='INFO' +qualname='turbogears.access' +handlers=['access_out'] +propagate=0 diff --git a/funcweb/funcweb.egg-info/PKG-INFO b/funcweb/funcweb.egg-info/PKG-INFO new file mode 100644 index 0000000..c355bdb --- /dev/null +++ b/funcweb/funcweb.egg-info/PKG-INFO @@ -0,0 +1,15 @@ +Metadata-Version: 1.0 +Name: funcweb +Version: 1.0 +Summary: UNKNOWN +Home-page: UNKNOWN +Author: UNKNOWN +Author-email: UNKNOWN +License: UNKNOWN +Description: UNKNOWN +Platform: UNKNOWN +Classifier: Development Status :: 3 - Alpha +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Framework :: TurboGears diff --git a/funcweb/funcweb.egg-info/SOURCES.txt b/funcweb/funcweb.egg-info/SOURCES.txt new file mode 100644 index 0000000..f1147f3 --- /dev/null +++ b/funcweb/funcweb.egg-info/SOURCES.txt @@ -0,0 +1,21 @@ +README.txt +setup.py +start-funcweb.py +funcweb/__init__.py +funcweb/controllers.py +funcweb/json.py +funcweb/model.py +funcweb/release.py +funcweb.egg-info/PKG-INFO +funcweb.egg-info/SOURCES.txt +funcweb.egg-info/dependency_links.txt +funcweb.egg-info/not-zip-safe +funcweb.egg-info/paster_plugins.txt +funcweb.egg-info/requires.txt +funcweb.egg-info/sqlobject.txt +funcweb.egg-info/top_level.txt +funcweb/config/__init__.py +funcweb/templates/__init__.py +funcweb/tests/__init__.py +funcweb/tests/test_controllers.py +funcweb/tests/test_model.py diff --git a/funcweb/funcweb.egg-info/dependency_links.txt b/funcweb/funcweb.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/funcweb/funcweb.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/funcweb/funcweb.egg-info/not-zip-safe b/funcweb/funcweb.egg-info/not-zip-safe new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/funcweb/funcweb.egg-info/not-zip-safe @@ -0,0 +1 @@ + diff --git a/funcweb/funcweb.egg-info/paster_plugins.txt b/funcweb/funcweb.egg-info/paster_plugins.txt new file mode 100644 index 0000000..14fec70 --- /dev/null +++ b/funcweb/funcweb.egg-info/paster_plugins.txt @@ -0,0 +1,2 @@ +TurboGears +PasteScript diff --git a/funcweb/funcweb.egg-info/requires.txt b/funcweb/funcweb.egg-info/requires.txt new file mode 100644 index 0000000..df5d977 --- /dev/null +++ b/funcweb/funcweb.egg-info/requires.txt @@ -0,0 +1 @@ +TurboGears >= 1.0.3.2 \ No newline at end of file diff --git a/funcweb/funcweb.egg-info/sqlobject.txt b/funcweb/funcweb.egg-info/sqlobject.txt new file mode 100644 index 0000000..ab2de8d --- /dev/null +++ b/funcweb/funcweb.egg-info/sqlobject.txt @@ -0,0 +1,2 @@ +db_module=funcweb.model +history_dir=$base/funcweb/sqlobject-history diff --git a/funcweb/funcweb.egg-info/top_level.txt b/funcweb/funcweb.egg-info/top_level.txt new file mode 100644 index 0000000..a443101 --- /dev/null +++ b/funcweb/funcweb.egg-info/top_level.txt @@ -0,0 +1 @@ +funcweb diff --git a/funcweb/funcweb/__init__.py b/funcweb/funcweb/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funcweb/funcweb/config/__init__.py b/funcweb/funcweb/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funcweb/funcweb/config/app.cfg b/funcweb/funcweb/config/app.cfg new file mode 100644 index 0000000..5734a78 --- /dev/null +++ b/funcweb/funcweb/config/app.cfg @@ -0,0 +1,52 @@ +[global] +# The settings in this file should not vary depending on the deployment +# environment. dev.cfg and prod.cfg are the locations for +# the different deployment settings. Settings in this file will +# be overridden by settings in those other files. + +# The commented out values below are the defaults + +# VIEW + +# which view (template engine) to use if one is not specified in the +# template name +# tg.defaultview = "kid" + +# The following kid settings determine the settings used by the kid serializer. + +# Kid output method (e.g. html, html-strict, xhtml, xhtml-strict, xml, json) +# and formatting (e.g. default, straight, compact, newlines, wrap, nice) +# kid.outputformat="html default" + +# kid.encoding="utf-8" + +# The sitetemplate is used for overall styling of a site that +# includes multiple TurboGears applications +# tg.sitetemplate="" + +# Allow every exposed function to be called as json, +# tg.allow_json = False + +# List of Widgets to include on every page. +# for exemple ['turbogears.mochikit'] +# tg.include_widgets = [] + +# Set to True if the scheduler should be started +# tg.scheduler = False + +# Set session or cookie +# session_filter.on = True + + +# compress the data sends to the web browser +# [/] +# gzip_filter.on = True +# gzip_filter.mime_types = ["application/x-javascript", "text/javascript", "text/html", "text/css", "text/plain"] + +[/static] +static_filter.on = True +static_filter.dir = "%(top_level_dir)s/static" + +[/favicon.ico] +static_filter.on = True +static_filter.file = "%(top_level_dir)s/static/images/favicon.ico" diff --git a/funcweb/funcweb/config/log.cfg b/funcweb/funcweb/config/log.cfg new file mode 100644 index 0000000..ce776f8 --- /dev/null +++ b/funcweb/funcweb/config/log.cfg @@ -0,0 +1,29 @@ +# LOGGING +# Logging is often deployment specific, but some handlers and +# formatters can be defined here. + +[logging] +[[formatters]] +[[[message_only]]] +format='*(message)s' + +[[[full_content]]] +format='*(asctime)s *(name)s *(levelname)s *(message)s' + +[[handlers]] +[[[debug_out]]] +class='StreamHandler' +level='DEBUG' +args='(sys.stdout,)' +formatter='full_content' + +[[[access_out]]] +class='StreamHandler' +level='INFO' +args='(sys.stdout,)' +formatter='message_only' + +[[[error_out]]] +class='StreamHandler' +level='ERROR' +args='(sys.stdout,)' diff --git a/funcweb/funcweb/controllers.py b/funcweb/funcweb/controllers.py new file mode 100644 index 0000000..5206727 --- /dev/null +++ b/funcweb/funcweb/controllers.py @@ -0,0 +1,12 @@ +from turbogears import controllers, expose, flash +# from model import * +# import logging +# log = logging.getLogger("funcweb.controllers") + +class Root(controllers.RootController): + @expose(template="funcweb.templates.welcome") + def index(self): + import time + # log.debug("Happy TurboGears Controller Responding For Duty") + flash("Your application is now running") + return dict(now=time.ctime()) diff --git a/funcweb/funcweb/json.py b/funcweb/funcweb/json.py new file mode 100644 index 0000000..66d5cfb --- /dev/null +++ b/funcweb/funcweb/json.py @@ -0,0 +1,10 @@ +# A JSON-based API(view) for your app. +# Most rules would look like: +# @jsonify.when("isinstance(obj, YourClass)") +# def jsonify_yourclass(obj): +# return [obj.val1, obj.val2] +# @jsonify can convert your objects to following types: +# lists, dicts, numbers and strings + +from turbojson.jsonify import jsonify + diff --git a/funcweb/funcweb/model.py b/funcweb/funcweb/model.py new file mode 100644 index 0000000..28f2b02 --- /dev/null +++ b/funcweb/funcweb/model.py @@ -0,0 +1,9 @@ +from turbogears.database import PackageHub +from sqlobject import * + +hub = PackageHub('funcweb') +__connection__ = hub + +# class YourDataClass(SQLObject): +# pass + diff --git a/funcweb/funcweb/release.py b/funcweb/funcweb/release.py new file mode 100644 index 0000000..94244db --- /dev/null +++ b/funcweb/funcweb/release.py @@ -0,0 +1,14 @@ +# Release information about funcweb + +version = "1.0" + +# description = "Your plan to rule the world" +# long_description = "More description about your plan" +# author = "Your Name Here" +# email = "YourEmail@YourDomain" +# copyright = "Vintage 2006 - a good year indeed" + +# if it's open source, you might want to specify these +# url = "http://yourcool.site/" +# download_url = "http://yourcool.site/download" +# license = "MIT" diff --git a/funcweb/funcweb/static/css/style.css b/funcweb/funcweb/static/css/style.css new file mode 100644 index 0000000..c98d40e --- /dev/null +++ b/funcweb/funcweb/static/css/style.css @@ -0,0 +1,134 @@ +/* + * Quick mash-up of CSS for the TG quick start page. + */ + +html, body { + color: black; + background-color: #ddd; + font: x-small "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, sans-serif; + margin: 0; + padding: 0; +} + +td, th {padding:3px;border:none;} +tr th {text-align:left;background-color:#f0f0f0;color:#333;} +tr.odd td {background-color:#edf3fe;} +tr.even td {background-color:#fff;} + +#header { + height: 80px; + width: 777px; + background: blue URL('../images/header_inner.png') no-repeat; + border-left: 1px solid #aaa; + border-right: 1px solid #aaa; + margin: 0 auto 0 auto; +} + +a.link, a, a.active { + color: #369; +} + + +#main_content { + color: black; + font-size: 127%; + background-color: white; + width: 757px; + margin: 0 auto 0 auto; + border-left: 1px solid #aaa; + border-right: 1px solid #aaa; + padding: 10px; +} + +#sidebar { + border: 1px solid #aaa; + background-color: #eee; + margin: 0.5em; + padding: 1em; + float: right; + width: 200px; + font-size: 88%; +} + +#sidebar h2 { + margin-top: 0; +} + +#sidebar ul { + margin-left: 1.5em; + padding-left: 0; +} + +h1,h2,h3,h4,h5,h6,#getting_started_steps { + font-family: "Century Schoolbook L", Georgia, serif; + font-weight: bold; +} + +h2 { + font-size: 150%; +} + +#getting_started_steps a { + text-decoration: none; +} + +#getting_started_steps a:hover { + text-decoration: underline; +} + +#getting_started_steps li { + font-size: 80%; + margin-bottom: 0.5em; +} + +#getting_started_steps h2 { + font-size: 120%; +} + +#getting_started_steps p { + font: 100% "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, sans-serif; +} + +#footer { + border: 1px solid #aaa; + border-top: 0px none; + color: #999; + background-color: white; + padding: 10px; + font-size: 80%; + text-align: center; + width: 757px; + margin: 0 auto 1em auto; +} + +.code { + font-family: monospace; +} + +span.code { + font-weight: bold; + background: #eee; +} + +#status_block { + margin: 0 auto 0.5em auto; + padding: 15px 10px 15px 55px; + background: #cec URL('../images/ok.png') left center no-repeat; + border: 1px solid #9c9; + width: 450px; + font-size: 120%; + font-weight: bolder; +} + +.notice { + margin: 0.5em auto 0.5em auto; + padding: 15px 10px 15px 55px; + width: 450px; + background: #eef URL('../images/info.png') left center no-repeat; + border: 1px solid #cce; +} + +.fielderror { + color: red; + font-weight: bold; +} \ No newline at end of file diff --git a/funcweb/funcweb/static/images/favicon.ico b/funcweb/funcweb/static/images/favicon.ico new file mode 100644 index 0000000..332557b Binary files /dev/null and b/funcweb/funcweb/static/images/favicon.ico differ diff --git a/funcweb/funcweb/static/images/header_inner.png b/funcweb/funcweb/static/images/header_inner.png new file mode 100644 index 0000000..2b2d87d Binary files /dev/null and b/funcweb/funcweb/static/images/header_inner.png differ diff --git a/funcweb/funcweb/static/images/info.png b/funcweb/funcweb/static/images/info.png new file mode 100644 index 0000000..329c523 Binary files /dev/null and b/funcweb/funcweb/static/images/info.png differ diff --git a/funcweb/funcweb/static/images/ok.png b/funcweb/funcweb/static/images/ok.png new file mode 100644 index 0000000..fee6751 Binary files /dev/null and b/funcweb/funcweb/static/images/ok.png differ diff --git a/funcweb/funcweb/static/images/tg_under_the_hood.png b/funcweb/funcweb/static/images/tg_under_the_hood.png new file mode 100644 index 0000000..bc9c79c Binary files /dev/null and b/funcweb/funcweb/static/images/tg_under_the_hood.png differ diff --git a/funcweb/funcweb/static/images/under_the_hood_blue.png b/funcweb/funcweb/static/images/under_the_hood_blue.png new file mode 100644 index 0000000..90e84b7 Binary files /dev/null and b/funcweb/funcweb/static/images/under_the_hood_blue.png differ diff --git a/funcweb/funcweb/templates/__init__.py b/funcweb/funcweb/templates/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funcweb/funcweb/templates/login.kid b/funcweb/funcweb/templates/login.kid new file mode 100644 index 0000000..4fd6755 --- /dev/null +++ b/funcweb/funcweb/templates/login.kid @@ -0,0 +1,114 @@ + + + + + + Login + + + + +
+

Login

+

${message}

+
+ + + + + + + + + + + + +
+ + + +
+ + + +
+ +
+ + + +
+ +
+
+
+ + diff --git a/funcweb/funcweb/templates/master.kid b/funcweb/funcweb/templates/master.kid new file mode 100644 index 0000000..1b9841a --- /dev/null +++ b/funcweb/funcweb/templates/master.kid @@ -0,0 +1,47 @@ + + + + + + + Your title goes here + + + + + + +
+ + Login + + + Welcome ${tg.identity.user.display_name}. + Logout + +
+ +
+
+ +
+ + +
+ + + + diff --git a/funcweb/funcweb/templates/welcome.kid b/funcweb/funcweb/templates/welcome.kid new file mode 100644 index 0000000..9095267 --- /dev/null +++ b/funcweb/funcweb/templates/welcome.kid @@ -0,0 +1,47 @@ + + + + +Welcome to TurboGears + + + + +
+
    +
  1. +

    Model

    +

    Design models in the model.py.
    + Edit dev.cfg to use a different backend, or start with a pre-configured SQLite database.
    + Use script tg-admin sql create to create the database tables.

    +
  2. +
  3. +

    View

    +

    Edit html-like templates in the /templates folder;
    + Put all static contents in the /static folder.

    +
  4. +
  5. +

    Controller

    +

    Edit controllers.py and build your + website structure with the simplicity of Python objects.
    + TurboGears will automatically reload itself when you modify your project.

    +
  6. +
+
If you create something cool, please let people know, and consider contributing something back to the community.
+
+ + + diff --git a/funcweb/funcweb/tests/__init__.py b/funcweb/funcweb/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/funcweb/funcweb/tests/test_controllers.py b/funcweb/funcweb/tests/test_controllers.py new file mode 100644 index 0000000..3c26c58 --- /dev/null +++ b/funcweb/funcweb/tests/test_controllers.py @@ -0,0 +1,32 @@ +import unittest +import turbogears +from turbogears import testutil +from funcweb.controllers import Root +import cherrypy + +cherrypy.root = Root() + +class TestPages(unittest.TestCase): + + def setUp(self): + turbogears.startup.startTurboGears() + + def tearDown(self): + """Tests for apps using identity need to stop CP/TG after each test to + stop the VisitManager thread. + See http://trac.turbogears.org/turbogears/ticket/1217 for details. + """ + turbogears.startup.stopTurboGears() + + def test_method(self): + "the index method should return a string called now" + import types + result = testutil.call(cherrypy.root.index) + assert type(result["now"]) == types.StringType + + def test_indextitle(self): + "The indexpage should have the right title" + testutil.createRequest("/") + response = cherrypy.response.body[0].lower() + assert "welcome to turbogears" in response + diff --git a/funcweb/funcweb/tests/test_model.py b/funcweb/funcweb/tests/test_model.py new file mode 100644 index 0000000..903c2d8 --- /dev/null +++ b/funcweb/funcweb/tests/test_model.py @@ -0,0 +1,22 @@ +# If your project uses a database, you can set up database tests +# similar to what you see below. Be sure to set the db_uri to +# an appropriate uri for your testing database. sqlite is a good +# choice for testing, because you can use an in-memory database +# which is very fast. + +from turbogears import testutil, database +# from funcweb.model import YourDataClass, User + +# database.set_db_uri("sqlite:///:memory:") + +# class TestUser(testutil.DBTest): +# def get_model(self): +# return User +# def test_creation(self): +# "Object creation should set the name" +# obj = User(user_name = "creosote", +# email_address = "spam@python.not", +# display_name = "Mr Creosote", +# password = "Wafer-thin Mint") +# assert obj.display_name == "Mr Creosote" + diff --git a/funcweb/sample-prod.cfg b/funcweb/sample-prod.cfg new file mode 100644 index 0000000..6ca2b4e --- /dev/null +++ b/funcweb/sample-prod.cfg @@ -0,0 +1,84 @@ +[global] +# This is where all of your settings go for your production environment. +# You'll copy this file over to your production server and provide it +# as a command-line option to your start script. +# Settings that are the same for both development and production +# (such as template engine, encodings, etc.) all go in +# funcweb/config/app.cfg + +# DATABASE + +# pick the form for your database +# sqlobject.dburi="postgres://username@hostname/databasename" +# sqlobject.dburi="mysql://username:password@hostname:port/databasename" +# sqlobject.dburi="sqlite:///file_name_and_path" + +# If you have sqlite, here's a simple default to get you started +# in development +sqlobject.dburi="sqlite://%(current_dir_uri)s/devdata.sqlite" + + +# if you are using a database or table type without transactions +# (MySQL default, for example), you should turn off transactions +# by prepending notrans_ on the uri +# sqlobject.dburi="notrans_mysql://username:password@hostname:port/databasename" + +# for Windows users, sqlite URIs look like: +# sqlobject.dburi="sqlite:///drive_letter:/path/to/file" + + +# SERVER + +server.environment="production" + +# Sets the number of threads the server uses +# server.thread_pool = 1 + +# if this is part of a larger site, you can set the path +# to the TurboGears instance here +# server.webpath="" + +# Set to True if you are deploying your App behind a proxy +# e.g. Apache using mod_proxy +# base_url_filter.on = False + +# Set to True if your proxy adds the x_forwarded_host header +# base_url_filter.use_x_forwarded_host = True + +# If your proxy does not add the x_forwarded_host header, set +# the following to the *public* host url. +# (Note: This will be overridden by the use_x_forwarded_host option +# if it is set to True and the proxy adds the header correctly. +# base_url_filter.base_url = "http://www.example.com" + +# Set to True if you'd like to abort execution if a controller gets an +# unexpected parameter. False by default +# tg.strict_parameters = False + +# LOGGING +# Logging configuration generally follows the style of the standard +# Python logging module configuration. Note that when specifying +# log format messages, you need to use *() for formatting variables. +# Deployment independent log configuration is in funcweb/config/log.cfg +[logging] + +[[handlers]] + +[[[access_out]]] +# set the filename as the first argument below +args="('server.log',)" +class='FileHandler' +level='INFO' +formatter='message_only' + +[[loggers]] +[[[funcweb]]] +level='ERROR' +qualname='funcweb' +handlers=['error_out'] + +[[[access]]] +level='INFO' +qualname='turbogears.access' +handlers=['access_out'] +propagate=0 diff --git a/funcweb/setup.py b/funcweb/setup.py new file mode 100644 index 0000000..40e86ee --- /dev/null +++ b/funcweb/setup.py @@ -0,0 +1,69 @@ +from setuptools import setup, find_packages +from turbogears.finddata import find_package_data + +import os +execfile(os.path.join("funcweb", "release.py")) + +packages=find_packages() +package_data = find_package_data(where='funcweb', + package='funcweb') +if os.path.isdir('locales'): + packages.append('locales') + package_data.update(find_package_data(where='locales', + exclude=('*.po',), only_in_packages=False)) + +setup( + name="funcweb", + version=version, + + # uncomment the following lines if you fill them out in release.py + #description=description, + #author=author, + #author_email=email, + #url=url, + #download_url=download_url, + #license=license, + + install_requires=[ + "TurboGears >= 1.0.3.2", + ], + scripts=["start-funcweb.py"], + zip_safe=False, + packages=packages, + package_data=package_data, + keywords=[ + # Use keywords if you'll be adding your package to the + # Python Cheeseshop + + # if this has widgets, uncomment the next line + # 'turbogears.widgets', + + # if this has a tg-admin command, uncomment the next line + # 'turbogears.command', + + # if this has identity providers, uncomment the next line + # 'turbogears.identity.provider', + + # If this is a template plugin, uncomment the next line + # 'python.templating.engines', + + # If this is a full application, uncomment the next line + # 'turbogears.app', + ], + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Framework :: TurboGears', + # if this is an application that you'll distribute through + # the Cheeseshop, uncomment the next line + # 'Framework :: TurboGears :: Applications', + + # if this is a package that includes widgets that you'll distribute + # through the Cheeseshop, uncomment the next line + # 'Framework :: TurboGears :: Widgets', + ], + test_suite='nose.collector', + ) + diff --git a/funcweb/start-funcweb.py b/funcweb/start-funcweb.py new file mode 100755 index 0000000..604cf19 --- /dev/null +++ b/funcweb/start-funcweb.py @@ -0,0 +1,25 @@ +#!/usr/bin/python +__requires__="TurboGears" +import pkg_resources + +from turbogears import config, update_config, start_server +import cherrypy +cherrypy.lowercase_api = True +from os.path import * +import sys + +# first look on the command line for a desired config file, +# if it's not on the command line, then +# look for setup.py in this directory. If it's not there, this script is +# probably installed +if len(sys.argv) > 1: + update_config(configfile=sys.argv[1], + modulename="funcweb.config") +elif exists(join(dirname(__file__), "setup.py")): + update_config(configfile="dev.cfg",modulename="funcweb.config") +else: + update_config(configfile="prod.cfg",modulename="funcweb.config") +config.update(dict(package="funcweb")) + +from funcweb.controllers import Root +start_server(Root()) diff --git a/funcweb/test.cfg b/funcweb/test.cfg new file mode 100644 index 0000000..df909c9 --- /dev/null +++ b/funcweb/test.cfg @@ -0,0 +1,4 @@ +# You can place test-specific configuration options here (like test db uri, etc) + +sqlobject.dburi = "sqlite:///:memory:" + -- cgit