diff options
author | Ryan Petrello <lists@ryanpetrello.com> | 2010-12-15 11:15:38 -0500 |
---|---|---|
committer | Ryan Petrello <lists@ryanpetrello.com> | 2010-12-15 11:15:38 -0500 |
commit | e7e2066b502d0cfea316433b3018d6dff2286a50 (patch) | |
tree | b1e2e07b97a3ce0af4a8162d8af464811a09fa01 | |
parent | bbc8099848b54ab6a79c4a8d9b371fc2b4b69f1b (diff) | |
download | pecan-e7e2066b502d0cfea316433b3018d6dff2286a50.tar.gz |
Establishing a few very simple conventions in pecan project template for models. Updating the quick_start docs with more information on how to handle model binding. At some point, more documentation/recipes to follow.
-rw-r--r-- | docs/0.0.1/source/quick_start.rst | 14 | ||||
-rw-r--r-- | pecan/__init__.pyc | bin | 0 -> 1159 bytes | |||
-rwxr-xr-x | pecan/configuration.pyc | bin | 0 -> 5842 bytes | |||
-rw-r--r-- | pecan/decorators.pyc | bin | 0 -> 1884 bytes | |||
-rw-r--r-- | pecan/default_config.pyc | bin | 0 -> 324 bytes | |||
-rw-r--r-- | pecan/pecan.pyc | bin | 0 -> 7237 bytes | |||
-rw-r--r-- | pecan/routing.pyc | bin | 0 -> 1670 bytes | |||
-rw-r--r-- | pecan/templating.pyc | bin | 0 -> 3282 bytes | |||
-rw-r--r-- | templates/__init__.pyc | bin | 0 -> 507 bytes | |||
-rw-r--r-- | templates/project/+egg+/model/__init__.py | 5 | ||||
-rw-r--r-- | templates/project/start.py_tmpl | 2 |
11 files changed, 16 insertions, 5 deletions
diff --git a/docs/0.0.1/source/quick_start.rst b/docs/0.0.1/source/quick_start.rst index 73dd1ad..e6d8429 100644 --- a/docs/0.0.1/source/quick_start.rst +++ b/docs/0.0.1/source/quick_start.rst @@ -16,7 +16,7 @@ example project:: $ paster create -t pecan-base -The above commnad will prompt you for a project name. I chose *test_project*, +The above command will prompt you for a project name. I chose *test_project*, this is how it looks like when we run the whole command:: $ paster create -t pecan-base @@ -37,6 +37,9 @@ this is how it looks like when we run the whole command:: Creating ./test_project/test_project/controllers/ Copying __init__.py to ./test_project/test_project/controllers/__init__.py Copying root.py to ./test_project/test_project/controllers/root.py + Recursing into model + Creating ./test_project/test_project/model/ + Copying __init__.py to ./test_project/test_project/model/__init__.py Recursing into templates Creating ./test_project/test_project/templates/ Copying index.html to ./test_project/test_project/templates/index.html @@ -68,12 +71,14 @@ This is how the structure of your new project should look like:: ├── controllers │ ├── __init__.py │ └── root.py + ├── model + │ ├── __init__.py └── templates ├── index.html ├── layout.html └── success.html - 6 directories, 10 files + 7 directories, 11 files A few things have been set for you, let's review them one by one: @@ -89,9 +94,8 @@ most part, it will contain your models, controllers and templates: * **controllers**: The container directory for your controller files. * **templates**: All your templates would go in here. -Note how there is no **model** directory. Since we haven't defined any -database for the app the template doesn't supply you one. In case you need it -later you could create a ``models.py`` file or a ``model`` directory. +To avoid unneeded dependencies and to remain as flexible as possible, Pecan doesn't impose any database or +ORM out of the box. You may notice that **model/__init__.py** is mostly empty. Its contents generally contain any code necessary define tables, ORM definitions, and parse bindings from ``pecan.conf``. .. _running_application: diff --git a/pecan/__init__.pyc b/pecan/__init__.pyc Binary files differnew file mode 100644 index 0000000..32b8354 --- /dev/null +++ b/pecan/__init__.pyc diff --git a/pecan/configuration.pyc b/pecan/configuration.pyc Binary files differnew file mode 100755 index 0000000..eb948cf --- /dev/null +++ b/pecan/configuration.pyc diff --git a/pecan/decorators.pyc b/pecan/decorators.pyc Binary files differnew file mode 100644 index 0000000..2dc857c --- /dev/null +++ b/pecan/decorators.pyc diff --git a/pecan/default_config.pyc b/pecan/default_config.pyc Binary files differnew file mode 100644 index 0000000..6c53de0 --- /dev/null +++ b/pecan/default_config.pyc diff --git a/pecan/pecan.pyc b/pecan/pecan.pyc Binary files differnew file mode 100644 index 0000000..fa15c64 --- /dev/null +++ b/pecan/pecan.pyc diff --git a/pecan/routing.pyc b/pecan/routing.pyc Binary files differnew file mode 100644 index 0000000..cfe537a --- /dev/null +++ b/pecan/routing.pyc diff --git a/pecan/templating.pyc b/pecan/templating.pyc Binary files differnew file mode 100644 index 0000000..e65559c --- /dev/null +++ b/pecan/templating.pyc diff --git a/templates/__init__.pyc b/templates/__init__.pyc Binary files differnew file mode 100644 index 0000000..447d51d --- /dev/null +++ b/templates/__init__.pyc diff --git a/templates/project/+egg+/model/__init__.py b/templates/project/+egg+/model/__init__.py new file mode 100644 index 0000000..3d75b92 --- /dev/null +++ b/templates/project/+egg+/model/__init__.py @@ -0,0 +1,5 @@ +from pecan import conf + +def init_model(): + # Read and parse database bindings from pecan.conf + pass
\ No newline at end of file diff --git a/templates/project/start.py_tmpl b/templates/project/start.py_tmpl index 05f9f70..4561988 100644 --- a/templates/project/start.py_tmpl +++ b/templates/project/start.py_tmpl @@ -1,5 +1,6 @@ import sys from pecan import make_app, set_config, conf +from ${egg}.model import init_model if __name__ == '__main__': if len(sys.argv) <= 1: @@ -7,6 +8,7 @@ if __name__ == '__main__': sys.exit(1) set_config(sys.argv[1]) + init_model() app = make_app( conf.app.root, |