├── CHANGELOG.rst ├── README.rst ├── bottle ├── README.rst ├── bottle_app.py ├── hello.db ├── templates │ ├── db.tpl │ ├── hello.tpl │ └── master.tpl └── wsgi.wsgi ├── cakephp ├── README.rst └── app │ ├── config │ ├── core.php │ └── database.php │ ├── controllers │ └── hellos_controller.php │ ├── hello.db │ ├── models │ ├── datasources │ │ └── dbo │ │ │ └── dbo_sqlite3.php │ └── hello.php │ └── views │ ├── hellos │ ├── hellodb.ctp │ └── hellos.ctp │ └── layouts │ └── default.ctp ├── codeigniter ├── README.rst └── application │ ├── config │ ├── config.php │ ├── database.php │ └── routes.php │ ├── controllers │ ├── hello.php │ └── index.html │ ├── hello.db │ ├── index.html │ ├── models │ └── index.html │ └── views │ ├── hellodb.php │ ├── hellos.php │ └── index.html ├── django ├── HelloWorld │ ├── __init__.py │ ├── hello.db │ ├── manage.py │ ├── models │ │ ├── __init__.py │ │ └── hello.py │ ├── settings.py │ ├── templates │ │ ├── base.html │ │ ├── hellodb.html │ │ ├── hellos.html │ │ └── index.html │ ├── urls.py │ └── views.py ├── README.rst └── wsgi.wsgi ├── flask ├── README.rst ├── flask_app.py ├── hello.db ├── templates │ ├── db.html │ ├── hello.html │ └── master.html └── wsgi.wsgi ├── kohana ├── README.rst └── application │ ├── bootstrap.php │ ├── classes │ ├── controller │ │ ├── hello.php │ │ ├── hellodb.php │ │ ├── helloorm.php │ │ └── hellos.php │ └── model │ │ └── hello.php │ ├── config │ └── database.php │ ├── hello.db │ └── views │ ├── hellodb.php │ ├── helloorm.php │ ├── hellos.php │ └── master.php ├── pyramid ├── HelloWorld │ ├── CHANGES.txt │ ├── README.txt │ ├── hello.db │ ├── helloworld │ │ ├── __init__.py │ │ ├── models.py │ │ ├── templates │ │ │ ├── db.jinja2 │ │ │ ├── hello.jinja2 │ │ │ └── master.jinja2 │ │ └── views.py │ ├── production.ini │ └── setup.py ├── README.rst └── wsgi.wsgi ├── rails ├── Gemfile ├── README.rst ├── app │ ├── controllers │ │ └── hello_controller.rb │ ├── models │ │ └── hello.rb │ └── views │ │ ├── hello │ │ ├── hellodb.html.erb │ │ └── hellos.html.erb │ │ └── layouts │ │ └── application.html.erb ├── config │ ├── database.yml │ └── routes.rb └── db │ ├── production.sqlite3 │ └── seeds.rb ├── sinatra ├── README.rst ├── config.ru ├── hello.db ├── sinatra_app.rb └── views │ ├── hellodb.erb │ ├── hellos.erb │ └── layout.erb ├── symfony ├── README.rst ├── app │ ├── Resources │ │ └── views │ │ │ └── base.html.twig │ ├── autoload.php │ └── config │ │ ├── config.yml │ │ ├── parameters.ini │ │ └── routing.yml ├── hello.db └── src │ └── Acme │ └── HelloBundle │ ├── AcmeHelloBundle.php │ ├── Controller │ ├── DefaultController.php │ ├── HelloController.php │ └── HellodbController.php │ ├── DependencyInjection │ ├── AcmeHelloExtension.php │ └── Configuration.php │ ├── Entity │ └── Hello.php │ ├── Resources │ ├── config │ │ ├── routing.yml │ │ └── services.yml │ ├── doc │ │ └── index.rst │ ├── translations │ │ └── messages.fr.xliff │ └── views │ │ └── Default │ │ ├── hello.html.twig │ │ ├── hellodb.html.twig │ │ └── index.html.twig │ └── Tests │ └── Controller │ └── DefaultControllerTest.php ├── turbogears ├── HelloWorld │ ├── HelloWorld.egg-info │ │ ├── PKG-INFO │ │ ├── SOURCES.txt │ │ ├── dependency_links.txt │ │ ├── entry_points.txt │ │ ├── paster_plugins.txt │ │ ├── requires.txt │ │ └── top_level.txt │ ├── MANIFEST.in │ ├── README.txt │ ├── development.ini │ ├── ez_setup │ │ ├── README.txt │ │ └── __init__.py │ ├── hello.db │ ├── helloworld │ │ ├── __init__.py │ │ ├── config │ │ │ ├── __init__.py │ │ │ ├── app_cfg.py │ │ │ ├── deployment.ini │ │ │ ├── environment.py │ │ │ └── middleware.py │ │ ├── controllers │ │ │ ├── __init__.py │ │ │ ├── controller.template │ │ │ ├── error.py │ │ │ ├── root.py │ │ │ ├── secure.py │ │ │ └── template.py │ │ ├── i18n │ │ │ └── ru │ │ │ │ └── LC_MESSAGES │ │ │ │ └── helloworld.po │ │ ├── lib │ │ │ ├── __init__.py │ │ │ ├── app_globals.py │ │ │ ├── base.py │ │ │ └── helpers.py │ │ ├── model │ │ │ ├── __init__.py │ │ │ ├── hello.py │ │ │ └── model.template │ │ ├── templates │ │ │ ├── __init__.py │ │ │ ├── db.html │ │ │ ├── db.jinja │ │ │ ├── db.mak │ │ │ ├── hello.html │ │ │ ├── hello.jinja │ │ │ ├── hello.mak │ │ │ ├── master.html │ │ │ ├── master.jinja │ │ │ └── master.mak │ │ ├── tests │ │ │ ├── __init__.py │ │ │ ├── functional │ │ │ │ ├── __init__.py │ │ │ │ ├── test_authentication.py │ │ │ │ └── test_root.py │ │ │ └── models │ │ │ │ ├── __init__.py │ │ │ │ └── test_auth.py │ │ └── websetup │ │ │ ├── __init__.py │ │ │ ├── bootstrap.py │ │ │ └── schema.py │ ├── production.ini │ ├── setup.cfg │ ├── setup.py │ └── test.ini ├── README.rst └── wsgi.wsgi ├── webgo ├── README.rst ├── hello.db ├── hello.go └── tmpl │ ├── db.mustache │ ├── hellodb.mustache │ ├── hellos.mustache │ └── lipsum.mustache └── yii ├── README.rst └── protected ├── config └── main.php ├── controllers ├── HelloController.php ├── HellodbController.php └── HellosController.php ├── data ├── hello.db ├── schema.mysql.sql ├── schema.sqlite.sql └── testdrive.db ├── models └── Hello.php └── views ├── hellodb └── index.php ├── hellos └── index.php └── layouts └── main.php /CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Changelog 3 | ================================================================================ 4 | 5 | 6 | 09/12/2011 7 | ================================================================================ 8 | 9 | * Updated Ubuntu LTS AMI (ami-fbbf7892 ubuntu-images-us/ubuntu-lucid-10.04- 10 | amd64-server-20110719.manifest.xml) 11 | * Rails 2.x and 3.0 were dropped in favor of Rails 3.1. 12 | * CakePHP 1.2 was dropped in favor of 1.3, but Symfony and Yii were added as 13 | they seem to have considerable market share. 14 | * Corrected faulty configuration of CakePHP's caching engine. 15 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | Welcome to the great web framework shootout. Here you will find test code and 13 | benchmark results comparing the performance of a few of the most popular F/OSS 14 | web frameworks in use today. 15 | 16 | Please see `The Great Web Framework Shootout's website`_ for important 17 | disclaimers and other detailed information about these benchmarks. If you have 18 | any questions or comments, feel free to contact me on `Google+`_. 19 | 20 | .. _The Great Web Framework Shootout's website: 21 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 22 | .. _Google+: http://profiles.google.com/seedifferently 23 | 24 | 25 | "Do these results have any real world value?" 26 | ================================================================================ 27 | 28 | Probably not. When it comes to code, the slightest adjustments have the 29 | potential to change things drastically. While I have tried to perform each test 30 | as fairly and accurately as possible, it would be foolish to consider these 31 | results as scientific in any way. It should also be noted that my goal here was 32 | not necessarily to figure out how fast each framework could perform at its *most 33 | optimized* configuration (although built-in caching and other performance tweaks 34 | were usually enabled if the default configuration permitted it), but rather to 35 | see what a *minimal "out-of-the-box" experience* would look like. 36 | 37 | Additionally, nothing here is intended to make one web technology appear 38 | "better" than another. When it comes to using the right tool for the job, 39 | "faster" does not necessarily mean "better" (very few real world projects are 40 | going to depend solely on page request speeds). 41 | 42 | 43 | "Will you please add XYZ to the results?" 44 | ================================================================================ 45 | 46 | Maybe, if you can convince me that enough people would be interested in having 47 | it displayed next to heavyweights like Rails and Django. Fork the repository 48 | and submit a pull request under the `dev` branch with a test app in the same 49 | format as the other tests, and make sure you include your best sales pitch. 50 | Otherwise, I'd suggest you boot up the EC2 AMI and do your own benchmarking. 51 | 52 | 53 | Benchmark Results 54 | ================================================================================ 55 | 56 | Three basic tests were set up for each framework to run. Below are the results 57 | of each test in requests per second from highest (best performance) to lowest 58 | (worst performance). 59 | 60 | Remember: Comparing all of these framework tests side-by-side isn't really 61 | "fair" because they are all so different. Compiled languages (e.g. Go) are 62 | expected to be faster than scripted languages. Tests using an ORM (e.g. Rails, 63 | Django, Pyramid, etc.) are expected to be slower than tests using only a plain 64 | database library (e.g. Bottle, Flask, Sinatra, etc). 65 | 66 | Please see `the website`_ for more detailed information and a better breakdown 67 | of the tests (graphs included!). 68 | 69 | .. _the website: 70 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 71 | 72 | 73 | The "Hello World" String Test 74 | -------------------------------------------------------------------------------- 75 | 76 | This test simply spits out a string response. There's no template or DB calls 77 | involved, so the level of processing should be minimal. 78 | 79 | ================= ======== 80 | Framework Reqs/sec 81 | ================= ======== 82 | web.go (Go r59) 3346 83 | Pyramid 1.2 3026 84 | Bottle 0.9.6 2825 85 | Django 1.3.1 2159 86 | Flask 0.7.2 2054 87 | Sinatra 1.2.6 1583 88 | CodeIgniter 2.0.3 929 89 | TG 2.1.2 839 90 | Yii 1.1.8 726 91 | Kohana 3.2.0 714 92 | Rails 3.1 711 93 | Symfony 2.0.1 273 94 | CakePHP 1.3.11 254 95 | ================= ======== 96 | 97 | 98 | The "Hello World" Template Test 99 | -------------------------------------------------------------------------------- 100 | 101 | This test prints out Lorem Ipsum via a template (thus engaging the framework's 102 | templating systems). 103 | 104 | ================= ======== 105 | Framework Reqs/sec 106 | ================= ======== 107 | Bottle 0.9.6 2417 108 | web.go (Go r59) 1959 109 | Flask 0.7.2 1918 110 | Pyramid 1.2 1650 111 | Sinatra 1.2.6 1329 112 | Django 1.3.1 1005 113 | CodeIgniter 2.0.3 884 114 | Kohana 3.2.0 675 115 | TG 2.1.2 663 116 | Rails 3.1 625 117 | Yii 1.1.8 548 118 | CakePHP 1.3.11 203 119 | Symfony 2.0.1 171 120 | ================= ======== 121 | 122 | 123 | The "Hello World" Template Test With DB Query 124 | -------------------------------------------------------------------------------- 125 | 126 | This test loads 5 rows of Lorem Ipsum from a SQLite DB (via the default ORM or 127 | a sqlite3 driver) and then prints them out through a template (thus engaging 128 | both the framework’s ORM/DB driver and the templating system). 129 | 130 | ================= ======== 131 | Framework Reqs/sec 132 | ================= ======== 133 | Bottle 0.9.6 1562 134 | Flask 0.7.2 1191 135 | Sinatra 1.2.6 982 136 | web.go (Go r59) 741 137 | Pyramid 1.2 555 138 | CodeIgniter 2.0.3 542 139 | Django 1.3.1 465 140 | Rails 3.1 463 141 | Kohana 3.2.0 423 142 | TG 2.1.2 298 143 | Yii 1.1.8 201 144 | CakePHP 1.3.11 193 145 | Symfony 2.0.1 113 146 | ================= ======== 147 | 148 | 149 | Test Platform Setup 150 | ================================================================================ 151 | 152 | All tests were performed on Amazon's EC2 with the following configuration: 153 | 154 | * ami-fbbf7892 m1.large ubuntu-images-us/ubuntu-lucid-10.04-amd64-server- 155 | 20110719.manifest.xml 156 | * As a "Large" instance, Amazon describes the resources as: 7.5 GB of memory, 4 157 | EC2 Compute Units (2 virtual cores with 2 EC2 Compute Units each), 850 GB of 158 | local instance storage, 64-bit platform. 159 | * Apache 2.2.14 was used. (Yes, I know there are other options, but with 160 | Apache's market share I figured it would be a good baseline.) 161 | * Python 2.6.5 and mod_wsgi 2.8 (embedded mode) were used for the Python based 162 | tests. 163 | * Ruby 1.9.2p290 and Phusion Passenger 3.0.9 were used for the Ruby based tests. 164 | * PHP 5.3.2 (with APC enabled) was used for the PHP based tests. 165 | * ApacheBench was run with -n 10000 and -c 10 about 5-10 times each, and the 166 | "best guess average" was chosen. 167 | 168 | 169 | Most Recent Changes 170 | ================================================================================ 171 | 172 | 09/12/2011 173 | -------------------------------------------------------------------------------- 174 | 175 | * Updated Ubuntu LTS AMI (ami-fbbf7892 ubuntu-images-us/ubuntu-lucid-10.04- 176 | amd64-server-20110719.manifest.xml) 177 | * Rails 2.x and 3.0 were dropped in favor of Rails 3.1. 178 | * CakePHP 1.2 was dropped in favor of 1.3, but Symfony and Yii were added as 179 | they seem to have considerable market share. 180 | * Corrected faulty configuration of CakePHP's caching engine. 181 | 182 | See `CHANGELOG.rst`_ for more. 183 | 184 | .. _CHANGELOG.rst: http://github.com/seedifferently/the-great-web-framework- 185 | shootout/blob/master/CHANGELOG.rst 186 | -------------------------------------------------------------------------------- /bottle/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Bottle test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using Bottle **v0.9.6** and will likely perform 13 | differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /bottle/bottle_app.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sqlite3 3 | #from bottle import run 4 | from bottle import route 5 | from bottle import jinja2_template as template 6 | 7 | 8 | @route('/') 9 | def index(): 10 | return 'Hello World!' 11 | 12 | @route('/jinja_hello') 13 | def hello(): 14 | return template('templates/hello') 15 | 16 | @route('/jinja_sql') 17 | def hellodb(): 18 | db = sqlite3.connect(os.path.join(os.path.dirname(os.path.realpath(__file__))) + '/hello.db') 19 | 20 | rows = db.execute('select id, data from hello order by id asc') 21 | lipsum = [dict(id=row[0], data=row[1]) for row in rows.fetchall()] 22 | 23 | return template('templates/db', hello=lipsum) 24 | 25 | 26 | #if __name__ == '__main__': 27 | # from bottle import debug 28 | # debug(True) 29 | # run(host='localhost', port=8080) 30 | -------------------------------------------------------------------------------- /bottle/hello.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/bottle/hello.db -------------------------------------------------------------------------------- /bottle/templates/db.tpl: -------------------------------------------------------------------------------- 1 | {% extends "templates/master.tpl" %} 2 | {% block content %} 3 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

4 | 5 | 6 | {% for row in hello %} 7 | 8 | {% endfor %} 9 |
{{ row['id'] }}{{ row['data'] }}
10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /bottle/templates/hello.tpl: -------------------------------------------------------------------------------- 1 | {% extends "templates/master.tpl" %} 2 | {% block content %} 3 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

4 | 5 | {# 6 | 7 | {% for k, v in request.environ.iteritems() %} 8 | 9 | {% endfor %} 10 |
{{ k | escape }}{{ v | escape }}
11 | #} 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /bottle/templates/master.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World 5 | 6 | 7 | {% block content %}{% endblock %} 8 | 9 | 10 | -------------------------------------------------------------------------------- /bottle/wsgi.wsgi: -------------------------------------------------------------------------------- 1 | import os, sys 2 | 3 | # override stdout 4 | sys.stdout = sys.stderr 5 | 6 | # import site directives for virtualenv 7 | import site 8 | 9 | ALLDIRS = ['/var/www/venv_bottle/lib/python2.6/site-packages'] 10 | 11 | # Remember original sys.path. 12 | prev_sys_path = list(sys.path) 13 | 14 | # Add each new site-packages directory. 15 | for directory in ALLDIRS: 16 | site.addsitedir(directory) 17 | 18 | # Reorder sys.path so new directories at the front. 19 | new_sys_path = [] 20 | for item in list(sys.path): 21 | if item not in prev_sys_path: 22 | new_sys_path.append(item) 23 | sys.path.remove(item) 24 | sys.path[:0] = new_sys_path 25 | 26 | # append project root directory path 27 | path = '/var/www/bottle_096' 28 | if path not in sys.path: 29 | sys.path.append(path) 30 | 31 | os.environ['PYTHON_EGG_CACHE'] = '/var/www/.python-eggs' 32 | 33 | os.chdir(os.path.dirname(__file__)) 34 | 35 | import bottle 36 | import bottle_app 37 | application = bottle.default_app() 38 | 39 | -------------------------------------------------------------------------------- /cakephp/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | CakePHP test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using CakePHP **v1.3.11** and will likely perform 13 | differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /cakephp/app/config/core.php: -------------------------------------------------------------------------------- 1 | cacheAction = true. 103 | * 104 | */ 105 | //Configure::write('Cache.check', true); 106 | 107 | /** 108 | * Defines the default error type when using the log() function. Used for 109 | * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG. 110 | */ 111 | define('LOG_ERROR', 2); 112 | 113 | /** 114 | * The preferred session handling method. Valid values: 115 | * 116 | * 'php' Uses settings defined in your php.ini. 117 | * 'cake' Saves session files in CakePHP's /tmp directory. 118 | * 'database' Uses CakePHP's database sessions. 119 | * 120 | * To define a custom session handler, save it at /app/config/.php. 121 | * Set the value of 'Session.save' to to utilize it in CakePHP. 122 | * 123 | * To use database sessions, run the app/config/schema/sessions.php schema using 124 | * the cake shell command: cake schema create Sessions 125 | * 126 | */ 127 | Configure::write('Session.save', 'php'); 128 | 129 | /** 130 | * The model name to be used for the session model. 131 | * 132 | * 'Session.save' must be set to 'database' in order to utilize this constant. 133 | * 134 | * The model name set here should *not* be used elsewhere in your application. 135 | */ 136 | //Configure::write('Session.model', 'Session'); 137 | 138 | /** 139 | * The name of the table used to store CakePHP database sessions. 140 | * 141 | * 'Session.save' must be set to 'database' in order to utilize this constant. 142 | * 143 | * The table name set here should *not* include any table prefix defined elsewhere. 144 | * 145 | * Please note that if you set a value for Session.model (above), any value set for 146 | * Session.table will be ignored. 147 | * 148 | * [Note: Session.table is deprecated as of CakePHP 1.3] 149 | */ 150 | //Configure::write('Session.table', 'cake_sessions'); 151 | 152 | /** 153 | * The DATABASE_CONFIG::$var to use for database session handling. 154 | * 155 | * 'Session.save' must be set to 'database' in order to utilize this constant. 156 | */ 157 | //Configure::write('Session.database', 'default'); 158 | 159 | /** 160 | * The name of CakePHP's session cookie. 161 | * 162 | * Note the guidelines for Session names states: "The session name references 163 | * the session id in cookies and URLs. It should contain only alphanumeric 164 | * characters." 165 | * @link http://php.net/session_name 166 | */ 167 | Configure::write('Session.cookie', 'CAKEPHP'); 168 | 169 | /** 170 | * Session time out time (in seconds). 171 | * Actual value depends on 'Security.level' setting. 172 | */ 173 | Configure::write('Session.timeout', '120'); 174 | 175 | /** 176 | * If set to false, sessions are not automatically started. 177 | */ 178 | Configure::write('Session.start', true); 179 | 180 | /** 181 | * When set to false, HTTP_USER_AGENT will not be checked 182 | * in the session. You might want to set the value to false, when dealing with 183 | * older versions of IE, Chrome Frame or certain web-browsing devices and AJAX 184 | */ 185 | Configure::write('Session.checkAgent', true); 186 | 187 | /** 188 | * The level of CakePHP security. The session timeout time defined 189 | * in 'Session.timeout' is multiplied according to the settings here. 190 | * Valid values: 191 | * 192 | * 'high' Session timeout in 'Session.timeout' x 10 193 | * 'medium' Session timeout in 'Session.timeout' x 100 194 | * 'low' Session timeout in 'Session.timeout' x 300 195 | * 196 | * CakePHP session IDs are also regenerated between requests if 197 | * 'Security.level' is set to 'high'. 198 | */ 199 | Configure::write('Security.level', 'medium'); 200 | 201 | /** 202 | * A random string used in security hashing methods. 203 | */ 204 | Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2gawftf2G0FgaC9mi'); 205 | 206 | /** 207 | * A random numeric string (digits only) used to encrypt/decrypt strings. 208 | */ 209 | Configure::write('Security.cipherSeed', '76859309657453542496749683645'); 210 | 211 | /** 212 | * Apply timestamps with the last modified time to static assets (js, css, images). 213 | * Will append a querystring parameter containing the time the file was modified. This is 214 | * useful for invalidating browser caches. 215 | * 216 | * Set to `true` to apply timestamps, when debug = 0, or set to 'force' to always enable 217 | * timestamping. 218 | */ 219 | //Configure::write('Asset.timestamp', true); 220 | /** 221 | * Compress CSS output by removing comments, whitespace, repeating tags, etc. 222 | * This requires a/var/cache directory to be writable by the web server for caching. 223 | * and /vendors/csspp/csspp.php 224 | * 225 | * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css(). 226 | */ 227 | //Configure::write('Asset.filter.css', 'css.php'); 228 | 229 | /** 230 | * Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the 231 | * output, and setting the config below to the name of the script. 232 | * 233 | * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link(). 234 | */ 235 | //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php'); 236 | 237 | /** 238 | * The classname and database used in CakePHP's 239 | * access control lists. 240 | */ 241 | Configure::write('Acl.classname', 'DbAcl'); 242 | Configure::write('Acl.database', 'default'); 243 | 244 | /** 245 | * If you are on PHP 5.3 uncomment this line and correct your server timezone 246 | * to fix the date & time related errors. 247 | */ 248 | //date_default_timezone_set('UTC'); 249 | 250 | /** 251 | * 252 | * Cache Engine Configuration 253 | * Default settings provided below 254 | * 255 | * File storage engine. 256 | * 257 | * Cache::config('default', array( 258 | * 'engine' => 'File', //[required] 259 | * 'duration'=> 3600, //[optional] 260 | * 'probability'=> 100, //[optional] 261 | * 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path 262 | * 'prefix' => 'cake_', //[optional] prefix every cache file with this string 263 | * 'lock' => false, //[optional] use file locking 264 | * 'serialize' => true, [optional] 265 | * )); 266 | * 267 | * 268 | * APC (http://pecl.php.net/package/APC) 269 | */ 270 | Cache::config('default', array( 271 | 'engine' => 'Apc', //[required] 272 | 'duration'=> 3600, //[optional] 273 | 'probability'=> 100, //[optional] 274 | 'prefix' => Inflector::slug(APP_DIR) . 'cp13_', //[optional] prefix every cache file with this string 275 | )); 276 | /* 277 | * Xcache (http://xcache.lighttpd.net/) 278 | * 279 | * Cache::config('default', array( 280 | * 'engine' => 'Xcache', //[required] 281 | * 'duration'=> 3600, //[optional] 282 | * 'probability'=> 100, //[optional] 283 | * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string 284 | * 'user' => 'user', //user from xcache.admin.user settings 285 | * 'password' => 'password', //plaintext password (xcache.admin.pass) 286 | * )); 287 | * 288 | * 289 | * Memcache (http://www.danga.com/memcached/) 290 | * 291 | * Cache::config('default', array( 292 | * 'engine' => 'Memcache', //[required] 293 | * 'duration'=> 3600, //[optional] 294 | * 'probability'=> 100, //[optional] 295 | * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string 296 | * 'servers' => array( 297 | * '127.0.0.1:11211' // localhost, default port 11211 298 | * ), //[optional] 299 | * 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory) 300 | * )); 301 | * 302 | */ 303 | //Cache::config('default', array('engine' => 'File')); 304 | -------------------------------------------------------------------------------- /cakephp/app/config/database.php: -------------------------------------------------------------------------------- 1 | The name of a supported driver; valid options are as follows: 33 | * mysql - MySQL 4 & 5, 34 | * mysqli - MySQL 4 & 5 Improved Interface (PHP5 only), 35 | * sqlite - SQLite (PHP5 only), 36 | * postgres - PostgreSQL 7 and higher, 37 | * mssql - Microsoft SQL Server 2000 and higher, 38 | * db2 - IBM DB2, Cloudscape, and Apache Derby (http://php.net/ibm-db2) 39 | * oracle - Oracle 8 and higher 40 | * firebird - Firebird/Interbase 41 | * sybase - Sybase ASE 42 | * adodb-[drivername] - ADOdb interface wrapper (see below), 43 | * odbc - ODBC DBO driver 44 | * 45 | * You can add custom database drivers (or override existing drivers) by adding the 46 | * appropriate file to app/models/datasources/dbo. Drivers should be named 'dbo_x.php', 47 | * where 'x' is the name of the database. 48 | * 49 | * persistent => true / false 50 | * Determines whether or not the database should use a persistent connection 51 | * 52 | * connect => 53 | * ADOdb set the connect to one of these 54 | * (http://phplens.com/adodb/supported.databases.html) and 55 | * append it '|p' for persistent connection. (mssql|p for example, or just mssql for not persistent) 56 | * For all other databases, this setting is deprecated. 57 | * 58 | * host => 59 | * the host you connect to the database. To add a socket or port number, use 'port' => # 60 | * 61 | * prefix => 62 | * Uses the given prefix for all the tables in this database. This setting can be overridden 63 | * on a per-table basis with the Model::$tablePrefix property. 64 | * 65 | * schema => 66 | * For Postgres and DB2, specifies which schema you would like to use the tables in. Postgres defaults to 67 | * 'public', DB2 defaults to empty. 68 | * 69 | * encoding => 70 | * For MySQL, MySQLi, Postgres and DB2, specifies the character encoding to use when connecting to the 71 | * database. Uses database default. 72 | * 73 | */ 74 | class DATABASE_CONFIG { 75 | 76 | var $default = array( 77 | 'driver' => 'sqlite3', 78 | 'persistent' => false, 79 | 'database' => '/var/www/cakephp_13/app/hello.db', 80 | 'connect' => 'sqlite' 81 | ); 82 | } 83 | -------------------------------------------------------------------------------- /cakephp/app/controllers/hellos_controller.php: -------------------------------------------------------------------------------- 1 | set('data', $this->Hello->find('all')); 19 | } 20 | } 21 | ?> 22 | 23 | -------------------------------------------------------------------------------- /cakephp/app/hello.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/cakephp/app/hello.db -------------------------------------------------------------------------------- /cakephp/app/models/hello.php: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /cakephp/app/views/hellos/hellodb.ctp: -------------------------------------------------------------------------------- 1 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

2 | 3 | 4 | 5 | 6 | 7 |
8 | -------------------------------------------------------------------------------- /cakephp/app/views/hellos/hellos.ctp: -------------------------------------------------------------------------------- 1 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

2 | 3 | -------------------------------------------------------------------------------- /cakephp/app/views/layouts/default.ctp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /codeigniter/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | CodeIgniter test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using CodeIgniter **v2.0.3** and will likely perform 13 | differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /codeigniter/application/config/config.php: -------------------------------------------------------------------------------- 1 | load->view('hellos'); 13 | } 14 | 15 | function hellodb() 16 | { 17 | $this->load->database(); 18 | $data['data'] = $this->db->get('hello'); 19 | $this->load->view('hellodb', $data); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /codeigniter/application/controllers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /codeigniter/application/hello.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/codeigniter/application/hello.db -------------------------------------------------------------------------------- /codeigniter/application/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /codeigniter/application/models/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /codeigniter/application/views/hellodb.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World 6 | 7 | 8 | 9 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

10 | 11 | 12 | result() as $row): ?> 13 | 14 | 15 |
id; ?>data; ?>
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /codeigniter/application/views/hellos.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World 6 | 7 | 8 | 9 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /codeigniter/application/views/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /django/HelloWorld/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/django/HelloWorld/__init__.py -------------------------------------------------------------------------------- /django/HelloWorld/hello.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/django/HelloWorld/hello.db -------------------------------------------------------------------------------- /django/HelloWorld/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from django.core.management import execute_manager 3 | import imp 4 | try: 5 | imp.find_module('settings') # Assumed to be in the same directory. 6 | except ImportError: 7 | import sys 8 | sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__) 9 | sys.exit(1) 10 | 11 | import settings 12 | 13 | if __name__ == "__main__": 14 | execute_manager(settings) 15 | -------------------------------------------------------------------------------- /django/HelloWorld/models/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /django/HelloWorld/models/hello.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | class Hello(models.Model): 4 | id = models.AutoField(primary_key=True) 5 | data = models.CharField('data', max_length=255) 6 | 7 | def __str__(self): 8 | return '%s, %s' % (self.id, self.data) 9 | 10 | class Meta: 11 | db_table = 'hello' 12 | -------------------------------------------------------------------------------- /django/HelloWorld/settings.py: -------------------------------------------------------------------------------- 1 | # Django settings for HelloWorld project. 2 | 3 | DEBUG = True 4 | TEMPLATE_DEBUG = DEBUG 5 | 6 | import os 7 | SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) 8 | 9 | ADMINS = ( 10 | # ('Your Name', 'your_email@example.com'), 11 | ) 12 | 13 | MANAGERS = ADMINS 14 | 15 | DATABASES = { 16 | 'default': { 17 | 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 18 | 'NAME': os.path.join(SITE_ROOT) + '/hello.db', # Or path to database file if using sqlite3. 19 | 'USER': '', # Not used with sqlite3. 20 | 'PASSWORD': '', # Not used with sqlite3. 21 | 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 22 | 'PORT': '', # Set to empty string for default. Not used with sqlite3. 23 | } 24 | } 25 | 26 | # Local time zone for this installation. Choices can be found here: 27 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name 28 | # although not all choices may be available on all operating systems. 29 | # On Unix systems, a value of None will cause Django to use the same 30 | # timezone as the operating system. 31 | # If running in a Windows environment this must be set to the same as your 32 | # system time zone. 33 | TIME_ZONE = 'America/Chicago' 34 | 35 | # Language code for this installation. All choices can be found here: 36 | # http://www.i18nguy.com/unicode/language-identifiers.html 37 | LANGUAGE_CODE = 'en-us' 38 | 39 | SITE_ID = 1 40 | 41 | # If you set this to False, Django will make some optimizations so as not 42 | # to load the internationalization machinery. 43 | USE_I18N = False 44 | 45 | # If you set this to False, Django will not format dates, numbers and 46 | # calendars according to the current locale 47 | USE_L10N = False 48 | 49 | # Absolute filesystem path to the directory that will hold user-uploaded files. 50 | # Example: "/home/media/media.lawrence.com/media/" 51 | MEDIA_ROOT = '' 52 | 53 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a 54 | # trailing slash. 55 | # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" 56 | MEDIA_URL = '' 57 | 58 | # Absolute path to the directory static files should be collected to. 59 | # Don't put anything in this directory yourself; store your static files 60 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. 61 | # Example: "/home/media/media.lawrence.com/static/" 62 | STATIC_ROOT = '' 63 | 64 | # URL prefix for static files. 65 | # Example: "http://media.lawrence.com/static/" 66 | STATIC_URL = '/static/' 67 | 68 | # URL prefix for admin static files -- CSS, JavaScript and images. 69 | # Make sure to use a trailing slash. 70 | # Examples: "http://foo.com/static/admin/", "/static/admin/". 71 | ADMIN_MEDIA_PREFIX = '/static/admin/' 72 | 73 | # Additional locations of static files 74 | STATICFILES_DIRS = ( 75 | # Put strings here, like "/home/html/static" or "C:/www/django/static". 76 | # Always use forward slashes, even on Windows. 77 | # Don't forget to use absolute paths, not relative paths. 78 | ) 79 | 80 | # List of finder classes that know how to find static files in 81 | # various locations. 82 | STATICFILES_FINDERS = ( 83 | 'django.contrib.staticfiles.finders.FileSystemFinder', 84 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 85 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder', 86 | ) 87 | 88 | # Make this unique, and don't share it with anybody. 89 | SECRET_KEY = 'chisbsgu3b@stsmjbrpdxv-tzt&vpa*10ld4wq*oyx53qv#ry)' 90 | 91 | # List of callables that know how to import templates from various sources. 92 | TEMPLATE_LOADERS = ( 93 | 'django.template.loaders.filesystem.Loader', 94 | 'django.template.loaders.app_directories.Loader', 95 | # 'django.template.loaders.eggs.Loader', 96 | ) 97 | 98 | MIDDLEWARE_CLASSES = ( 99 | # 'django.middleware.common.CommonMiddleware', 100 | # 'django.contrib.sessions.middleware.SessionMiddleware', 101 | # 'django.middleware.csrf.CsrfViewMiddleware', 102 | # 'django.contrib.auth.middleware.AuthenticationMiddleware', 103 | # 'django.contrib.messages.middleware.MessageMiddleware', 104 | ) 105 | 106 | ROOT_URLCONF = 'urls' 107 | 108 | TEMPLATE_DIRS = ( 109 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". 110 | # Always use forward slashes, even on Windows. 111 | # Don't forget to use absolute paths, not relative paths. 112 | os.path.join(SITE_ROOT) + '/templates' 113 | ) 114 | 115 | INSTALLED_APPS = ( 116 | # 'django.contrib.auth', 117 | # 'django.contrib.contenttypes', 118 | # 'django.contrib.sessions', 119 | # 'django.contrib.sites', 120 | # 'django.contrib.messages', 121 | # 'django.contrib.staticfiles', 122 | # Uncomment the next line to enable the admin: 123 | # 'django.contrib.admin', 124 | # Uncomment the next line to enable admin documentation: 125 | # 'django.contrib.admindocs', 126 | ) 127 | 128 | # A sample logging configuration. The only tangible logging 129 | # performed by this configuration is to send an email to 130 | # the site admins on every HTTP 500 error. 131 | # See http://docs.djangoproject.com/en/dev/topics/logging for 132 | # more details on how to customize your logging configuration. 133 | LOGGING = { 134 | 'version': 1, 135 | 'disable_existing_loggers': False, 136 | 'handlers': { 137 | 'mail_admins': { 138 | 'level': 'ERROR', 139 | 'class': 'django.utils.log.AdminEmailHandler' 140 | } 141 | }, 142 | 'loggers': { 143 | 'django.request': { 144 | 'handlers': ['mail_admins'], 145 | 'level': 'ERROR', 146 | 'propagate': True, 147 | }, 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /django/HelloWorld/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World 5 | 6 | 7 | {% block content %}{% endblock %} 8 | 9 | 10 | -------------------------------------------------------------------------------- /django/HelloWorld/templates/hellodb.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

4 | 5 | {% for row in data %} 6 | 7 | {% endfor %} 8 |
{{ row.id }}{{ row.data }}
9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /django/HelloWorld/templates/hellos.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

4 | {% endblock %} 5 | -------------------------------------------------------------------------------- /django/HelloWorld/templates/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/django/HelloWorld/templates/index.html -------------------------------------------------------------------------------- /django/HelloWorld/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls.defaults import patterns, include, url 2 | 3 | # Uncomment the next two lines to enable the admin: 4 | # from django.contrib import admin 5 | # admin.autodiscover() 6 | 7 | urlpatterns = patterns('', 8 | # Examples: 9 | # url(r'^$', 'HelloWorld.views.home', name='home'), 10 | # url(r'^HelloWorld/', include('HelloWorld.foo.urls')), 11 | 12 | # Uncomment the admin/doc line below to enable admin documentation: 13 | # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), 14 | 15 | # Uncomment the next line to enable the admin: 16 | # url(r'^admin/', include(admin.site.urls)), 17 | 18 | (r'^hello$', 'views.index'), 19 | (r'^dtl_hello$', 'views.dtl_hello'), 20 | (r'^dtl_sql$', 'views.dtl_sql'), 21 | ) 22 | -------------------------------------------------------------------------------- /django/HelloWorld/views.py: -------------------------------------------------------------------------------- 1 | from django.http import HttpResponse 2 | from django.shortcuts import render_to_response, get_object_or_404 3 | from models.hello import Hello 4 | 5 | def index(request): 6 | return HttpResponse("Hello World!") 7 | 8 | def dtl_hello(request): 9 | return render_to_response('hellos.html') 10 | 11 | def dtl_sql(request): 12 | data = Hello.objects.all() 13 | return render_to_response('hellodb.html', {'data': data}) 14 | -------------------------------------------------------------------------------- /django/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Django test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using Django **v1.3.1** and will likely perform 13 | differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /django/wsgi.wsgi: -------------------------------------------------------------------------------- 1 | import os, sys 2 | 3 | # override stdout 4 | sys.stdout = sys.stderr 5 | 6 | # import site directives for virtualenv 7 | import site 8 | 9 | ALLDIRS = ['/var/www/venv_django/lib/python2.6/site-packages'] 10 | 11 | # Remember original sys.path. 12 | prev_sys_path = list(sys.path) 13 | 14 | # Add each new site-packages directory. 15 | for directory in ALLDIRS: 16 | site.addsitedir(directory) 17 | 18 | # Reorder sys.path so new directories at the front. 19 | new_sys_path = [] 20 | for item in list(sys.path): 21 | if item not in prev_sys_path: 22 | new_sys_path.append(item) 23 | sys.path.remove(item) 24 | sys.path[:0] = new_sys_path 25 | 26 | # append project root directory path 27 | path = '/var/www/django_13/HelloWorld' 28 | if path not in sys.path: 29 | sys.path.append(path) 30 | 31 | os.environ['PYTHON_EGG_CACHE'] = '/var/www/.python-eggs' 32 | os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' 33 | 34 | # loadapp 35 | import django.core.handlers.wsgi 36 | application = django.core.handlers.wsgi.WSGIHandler() 37 | -------------------------------------------------------------------------------- /flask/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Flask test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using Flask **v0.7.2** and will likely perform 13 | differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /flask/flask_app.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sqlite3 3 | from flask import Flask, render_template 4 | app = Flask(__name__) 5 | 6 | 7 | @app.route('/') 8 | def index(): 9 | return 'Hello World!' 10 | 11 | @app.route('/jinja_hello') 12 | def hello(): 13 | return render_template('hello.html') 14 | 15 | @app.route('/jinja_sql') 16 | def hellodb(): 17 | db = sqlite3.connect(os.path.join(os.path.dirname(os.path.realpath(__file__))) + '/hello.db') 18 | 19 | rows = db.execute('select id, data from hello order by id asc') 20 | lipsum = [dict(id=row[0], data=row[1]) for row in rows.fetchall()] 21 | 22 | return render_template('db.html', hello=lipsum) 23 | 24 | 25 | if __name__ == '__main__': 26 | app.run(debug=True) 27 | -------------------------------------------------------------------------------- /flask/hello.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/flask/hello.db -------------------------------------------------------------------------------- /flask/templates/db.html: -------------------------------------------------------------------------------- 1 | {% extends "master.html" %} 2 | {% block content %} 3 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

4 | 5 | 6 | {% for row in hello %} 7 | 8 | {% endfor %} 9 |
{{ row['id'] }}{{ row['data'] }}
10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /flask/templates/hello.html: -------------------------------------------------------------------------------- 1 | {% extends "master.html" %} 2 | {% block content %} 3 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

4 | 5 | {# 6 | 7 | {% for k, v in request.environ.iteritems() %} 8 | 9 | {% endfor %} 10 |
{{ k | escape }}{{ v | escape }}
11 | #} 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /flask/templates/master.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World 5 | 6 | 7 | {% block content %}{% endblock %} 8 | 9 | 10 | -------------------------------------------------------------------------------- /flask/wsgi.wsgi: -------------------------------------------------------------------------------- 1 | import os, sys 2 | 3 | # override stdout 4 | sys.stdout = sys.stderr 5 | 6 | # import site directives for virtualenv 7 | import site 8 | 9 | ALLDIRS = ['/var/www/venv_flask/lib/python2.6/site-packages'] 10 | 11 | # Remember original sys.path. 12 | prev_sys_path = list(sys.path) 13 | 14 | # Add each new site-packages directory. 15 | for directory in ALLDIRS: 16 | site.addsitedir(directory) 17 | 18 | # Reorder sys.path so new directories at the front. 19 | new_sys_path = [] 20 | for item in list(sys.path): 21 | if item not in prev_sys_path: 22 | new_sys_path.append(item) 23 | sys.path.remove(item) 24 | sys.path[:0] = new_sys_path 25 | 26 | # append project root directory path 27 | path = '/var/www/flask_072' 28 | if path not in sys.path: 29 | sys.path.append(path) 30 | 31 | os.environ['PYTHON_EGG_CACHE'] = '/var/www/.python-eggs' 32 | 33 | from flask_app import app as application 34 | 35 | -------------------------------------------------------------------------------- /kohana/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Kohana test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using Kohana **v3.2.0** and will likely perform 13 | differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /kohana/application/bootstrap.php: -------------------------------------------------------------------------------- 1 | " 63 | */ 64 | if (isset($_SERVER['KOHANA_ENV'])) 65 | { 66 | Kohana::$environment = constant('Kohana::'.strtoupper($_SERVER['KOHANA_ENV'])); 67 | } 68 | 69 | /** 70 | * Initialize Kohana, setting the default options. 71 | * 72 | * The following options are available: 73 | * 74 | * - string base_url path, and optionally domain, of your application NULL 75 | * - string index_file name of your index file, usually "index.php" index.php 76 | * - string charset internal character set used for input and output utf-8 77 | * - string cache_dir set the internal cache directory APPPATH/cache 78 | * - boolean errors enable or disable error handling TRUE 79 | * - boolean profile enable or disable internal profiling TRUE 80 | * - boolean caching enable or disable internal caching FALSE 81 | */ 82 | Kohana::init(array( 83 | 'base_url' => '/kohana_32/', 84 | 'caching' => TRUE, 85 | 'index_file' => '', 86 | )); 87 | 88 | /** 89 | * Attach the file write to logging. Multiple writers are supported. 90 | */ 91 | Kohana::$log->attach(new Log_File(APPPATH.'logs')); 92 | 93 | /** 94 | * Attach a file reader to config. Multiple readers are supported. 95 | */ 96 | Kohana::$config->attach(new Config_File); 97 | 98 | /** 99 | * Enable modules. Modules are referenced by a relative or absolute path. 100 | */ 101 | Kohana::modules(array( 102 | // 'auth' => MODPATH.'auth', // Basic authentication 103 | // 'cache' => MODPATH.'cache', // Caching with multiple backends 104 | // 'codebench' => MODPATH.'codebench', // Benchmarking tool 105 | 'database' => MODPATH.'database', // Database access 106 | // 'image' => MODPATH.'image', // Image manipulation 107 | // 'orm' => MODPATH.'orm', // Object Relationship Mapping 108 | // 'unittest' => MODPATH.'unittest', // Unit testing 109 | // 'userguide' => MODPATH.'userguide', // User guide and API documentation 110 | )); 111 | 112 | /** 113 | * Set the routes. Each route must have a minimum of a name, a URI and a set of 114 | * defaults for the URI. 115 | */ 116 | Route::set('default', '((/(/)))') 117 | ->defaults(array( 118 | 'controller' => 'hello', 119 | 'action' => 'index', 120 | )); 121 | -------------------------------------------------------------------------------- /kohana/application/classes/controller/hello.php: -------------------------------------------------------------------------------- 1 | from('hello')->execute()->as_array(); 10 | 11 | $this->template->title = 'Hello World'; 12 | $this->template->data = $data; 13 | } 14 | 15 | } // End Welcome 16 | -------------------------------------------------------------------------------- /kohana/application/classes/controller/helloorm.php: -------------------------------------------------------------------------------- 1 | find_all(); 12 | 13 | $this->template->title = 'Hello World'; 14 | $this->template->data = $data; 15 | } 16 | 17 | } // End Welcome 18 | -------------------------------------------------------------------------------- /kohana/application/classes/controller/hellos.php: -------------------------------------------------------------------------------- 1 | template->title = 'Hello World'; 11 | } 12 | 13 | } // End Welcome 14 | -------------------------------------------------------------------------------- /kohana/application/classes/model/hello.php: -------------------------------------------------------------------------------- 1 | array 5 | ( 6 | 'type' => 'pdo', 7 | 'connection' => array( 8 | 'dsn' => 'sqlite:'.APPPATH.'hello.db', 9 | 'persistent' => FALSE, 10 | ), 11 | 'table_prefix' => '', 12 | 'charset' => NULL, 13 | 'profiling' => TRUE, 14 | ) 15 | ); 16 | ?> 17 | -------------------------------------------------------------------------------- /kohana/application/hello.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/kohana/application/hello.db -------------------------------------------------------------------------------- /kohana/application/views/hellodb.php: -------------------------------------------------------------------------------- 1 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

2 | 3 | 4 | 5 | 6 | 7 |
8 | -------------------------------------------------------------------------------- /kohana/application/views/helloorm.php: -------------------------------------------------------------------------------- 1 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

2 | 3 | 4 | 5 | 6 | 7 |
id; ?>data;?>
8 | -------------------------------------------------------------------------------- /kohana/application/views/hellos.php: -------------------------------------------------------------------------------- 1 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

2 | -------------------------------------------------------------------------------- /kohana/application/views/master.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World 6 | 7 | 8 | 9 | render(); 12 | } 13 | else if ($page == 'hellodb') { 14 | echo View::factory('hellodb', array('data' => $data))->render(); 15 | } 16 | else if ($page == 'helloorm') { 17 | echo View::factory('helloorm', array('data' => $data))->render(); 18 | } 19 | ?> 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /pyramid/HelloWorld/CHANGES.txt: -------------------------------------------------------------------------------- 1 | 0.1 2 | 3 | Initial version 4 | -------------------------------------------------------------------------------- /pyramid/HelloWorld/README.txt: -------------------------------------------------------------------------------- 1 | HelloWorld README 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /pyramid/HelloWorld/hello.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/pyramid/HelloWorld/hello.db -------------------------------------------------------------------------------- /pyramid/HelloWorld/helloworld/__init__.py: -------------------------------------------------------------------------------- 1 | from pyramid.config import Configurator 2 | from pyramid_jinja2 import renderer_factory 3 | from sqlalchemy import engine_from_config 4 | 5 | from helloworld.models import appmaker 6 | 7 | def app(global_config, **settings): 8 | """ This function returns a WSGI application. 9 | """ 10 | 11 | engine = engine_from_config(settings, 'sqlalchemy.') 12 | get_root = appmaker(engine) 13 | config = Configurator(settings=settings, root_factory=get_root) 14 | config.include('pyramid_jinja2') 15 | # config.add_static_view('static', 'helloworld:static', cache_max_age=3600) 16 | config.add_view('helloworld.views.string_hello') 17 | config.add_view('helloworld.views.raw_sql', 18 | name='raw_sql') 19 | config.add_view('helloworld.views.jinja_hello', 20 | name='jinja_hello', 21 | renderer="hello.jinja2") 22 | config.add_view('helloworld.views.jinja_sql', 23 | name='jinja_sql', 24 | renderer="db.jinja2") 25 | return config.make_wsgi_app() 26 | -------------------------------------------------------------------------------- /pyramid/HelloWorld/helloworld/models.py: -------------------------------------------------------------------------------- 1 | #import transaction 2 | 3 | from sqlalchemy.orm import scoped_session 4 | from sqlalchemy.orm import sessionmaker 5 | 6 | from sqlalchemy.ext.declarative import declarative_base 7 | 8 | from sqlalchemy.exc import IntegrityError 9 | #from sqlalchemy.orm.exc import NoResultFound 10 | 11 | #from sqlalchemy import create_engine 12 | from sqlalchemy import Integer 13 | from sqlalchemy import Unicode 14 | from sqlalchemy import Column 15 | 16 | from zope.sqlalchemy import ZopeTransactionExtension 17 | 18 | DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) 19 | Base = declarative_base() 20 | 21 | class Hello(Base): 22 | __tablename__ = 'hello' 23 | 24 | def __init__(self, id, data): 25 | self.id = id 26 | self.data = data 27 | 28 | #{ Columns 29 | 30 | id = Column(Integer, primary_key=True) 31 | data = Column(Unicode(255), nullable=False) 32 | 33 | #} 34 | 35 | class MyApp(object): 36 | __name__ = None 37 | __parent__ = None 38 | 39 | def __getitem__(self, key): 40 | session= DBSession() 41 | try: 42 | id = int(key) 43 | except (ValueError, TypeError): 44 | raise KeyError(key) 45 | 46 | query = session.query(Hello).filter_by(id=id) 47 | 48 | try: 49 | item = query.one() 50 | item.__parent__ = self 51 | item.__name__ = key 52 | return item 53 | except NoResultFound: 54 | raise KeyError(key) 55 | 56 | def get(self, key, default=None): 57 | try: 58 | item = self.__getitem__(key) 59 | except KeyError: 60 | item = default 61 | return item 62 | 63 | def __iter__(self): 64 | session= DBSession() 65 | query = session.query(Hello) 66 | return iter(query) 67 | 68 | root = MyApp() 69 | 70 | def get_root(request): 71 | return root 72 | 73 | def initialize_sql(engine): 74 | DBSession.configure(bind=engine) 75 | Base.metadata.bind = engine 76 | Base.metadata.create_all(engine) 77 | 78 | return DBSession 79 | 80 | def appmaker(engine): 81 | initialize_sql(engine) 82 | return get_root 83 | -------------------------------------------------------------------------------- /pyramid/HelloWorld/helloworld/templates/db.jinja2: -------------------------------------------------------------------------------- 1 | {% extends "master.jinja2" %} 2 | {% block content %} 3 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

4 | 5 | 6 | {% for row in hello %} 7 | 8 | {% endfor %} 9 |
{{ row.id }}{{ row.data }}
10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /pyramid/HelloWorld/helloworld/templates/hello.jinja2: -------------------------------------------------------------------------------- 1 | {% extends "master.jinja2" %} 2 | {% block content %} 3 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

4 | 5 | {# 6 | 7 | {% for k, v in request.environ.iteritems() %} 8 | 9 | {% endfor %} 10 |
{{ k | escape }}{{ v | escape }}
11 | #} 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /pyramid/HelloWorld/helloworld/templates/master.jinja2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World 5 | 6 | 7 | {% block content %}{% endblock %} 8 | 9 | 10 | -------------------------------------------------------------------------------- /pyramid/HelloWorld/helloworld/views.py: -------------------------------------------------------------------------------- 1 | from pyramid.response import Response 2 | from helloworld.models import DBSession 3 | from helloworld.models import Hello 4 | 5 | # RAW STRING TEST 6 | def string_hello(context, request): 7 | return Response('Hello World!') 8 | 9 | def jinja_hello(self): 10 | return dict() 11 | 12 | # DATABASE TESTS 13 | def raw_sql(self): 14 | output = [] 15 | hello = DBSession.query(Hello).all() 16 | for row in hello: 17 | output.append('%s - %s' % (row.id, row.data)) 18 | return Response('\n'.join(output)) 19 | 20 | def jinja_sql(self): 21 | hello = DBSession.query(Hello).all() 22 | return dict(hello=hello) 23 | -------------------------------------------------------------------------------- /pyramid/HelloWorld/production.ini: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | debug = false 3 | 4 | [app:main] 5 | use = egg:HelloWorld#app 6 | pyramid.reload_templates = false 7 | pyramid.debug_authorization = false 8 | pyramid.debug_notfound = false 9 | pyramid.debug_routematch = false 10 | pyramid.debug_templates = false 11 | pyramid.default_locale_name = en 12 | pyramid.jinja2.directories = helloworld:templates 13 | reload_templates = false 14 | jinja2.directories = helloworld:templates 15 | default_locale_name = en 16 | sqlalchemy.url = sqlite:///%(here)s/hello.db 17 | db_echo = false 18 | 19 | [server:main] 20 | use = egg:Paste#http 21 | host = 0.0.0.0 22 | port = 6543 23 | -------------------------------------------------------------------------------- /pyramid/HelloWorld/setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from setuptools import setup, find_packages 4 | 5 | here = os.path.abspath(os.path.dirname(__file__)) 6 | README = open(os.path.join(here, 'README.txt')).read() 7 | CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() 8 | 9 | requires = [ 10 | 'pyramid==1.2', 11 | 'pyramid_jinja2', 12 | # 'repoze.tm2', 13 | 'sqlalchemy==0.7.2', 14 | 'zope.sqlalchemy', 15 | # 'WebError', 16 | ] 17 | 18 | setup(name='HelloWorld', 19 | version='0.1', 20 | description='HelloWorld', 21 | long_description=README + '\n\n' + CHANGES, 22 | classifiers=[ 23 | "Programming Language :: Python", 24 | "Framework :: Pylons", 25 | "Topic :: Internet :: WWW/HTTP", 26 | "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", 27 | ], 28 | author='', 29 | author_email='', 30 | url='', 31 | keywords='web pyramid pylons', 32 | packages=find_packages(), 33 | include_package_data=True, 34 | zip_safe=False, 35 | install_requires=requires, 36 | tests_require=requires, 37 | test_suite="helloworld", 38 | entry_points = """\ 39 | [paste.app_factory] 40 | app = helloworld:app 41 | """, 42 | paster_plugins=['pyramid'], 43 | ) 44 | 45 | -------------------------------------------------------------------------------- /pyramid/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Pyramid test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using Pyramid **v1.2.0** and will likely perform 13 | differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /pyramid/wsgi.wsgi: -------------------------------------------------------------------------------- 1 | import os, sys 2 | 3 | # override stdout 4 | sys.stdout = sys.stderr 5 | 6 | # import site directives for virtualenv 7 | import site 8 | 9 | ALLDIRS = ['/var/www/venv_pyramid/lib/python2.6/site-packages'] 10 | 11 | # Remember original sys.path. 12 | prev_sys_path = list(sys.path) 13 | 14 | # Add each new site-packages directory. 15 | for directory in ALLDIRS: 16 | site.addsitedir(directory) 17 | 18 | # Reorder sys.path so new directories at the front. 19 | new_sys_path = [] 20 | for item in list(sys.path): 21 | if item not in prev_sys_path: 22 | new_sys_path.append(item) 23 | sys.path.remove(item) 24 | sys.path[:0] = new_sys_path 25 | 26 | # append project root directory path 27 | path = '/var/www/pyramid_1.2/HelloWorld' 28 | if path not in sys.path: 29 | sys.path.append(path) 30 | 31 | os.environ['PYTHON_EGG_CACHE'] = '/var/www/.python-eggs' 32 | 33 | # loadapp 34 | from pyramid.paster import get_app 35 | application = get_app('/var/www/pyramid_12/HelloWorld/production.ini', 'main') 36 | -------------------------------------------------------------------------------- /rails/Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | gem 'rails', '3.1.0' 4 | 5 | # Bundle edge Rails instead: 6 | # gem 'rails', :git => 'git://github.com/rails/rails.git' 7 | 8 | gem 'sqlite3' 9 | 10 | 11 | # Gems used only for assets and not required 12 | # in production environments by default. 13 | group :assets do 14 | gem 'sass-rails', " ~> 3.1.0" 15 | gem 'coffee-rails', "~> 3.1.0" 16 | gem 'uglifier' 17 | end 18 | 19 | gem 'jquery-rails' 20 | 21 | # Use unicorn as the web server 22 | # gem 'unicorn' 23 | 24 | # Deploy with Capistrano 25 | # gem 'capistrano' 26 | 27 | # To use debugger 28 | # gem 'ruby-debug19', :require => 'ruby-debug' 29 | 30 | group :test do 31 | # Pretty printed test output 32 | gem 'turn', :require => false 33 | end 34 | -------------------------------------------------------------------------------- /rails/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Rails test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using Ruby on Rails **v3.1.0** and will likely perform 13 | differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /rails/app/controllers/hello_controller.rb: -------------------------------------------------------------------------------- 1 | class HelloController < ApplicationController 2 | def hello 3 | render :text => "Hello World!" 4 | end 5 | def hellos 6 | end 7 | def hellodb 8 | @data = Hello.all 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /rails/app/models/hello.rb: -------------------------------------------------------------------------------- 1 | class Hello < ActiveRecord::Base 2 | end 3 | -------------------------------------------------------------------------------- /rails/app/views/hello/hellodb.html.erb: -------------------------------------------------------------------------------- 1 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

2 | 3 | 4 | <% for row in @data %> 5 | 6 | <% end %> 7 |
<%=h row.id %><%=h row.data %>
8 | -------------------------------------------------------------------------------- /rails/app/views/hello/hellos.html.erb: -------------------------------------------------------------------------------- 1 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

2 | -------------------------------------------------------------------------------- /rails/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World 5 | 6 | 7 | 8 | <%= yield %> 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /rails/config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | #development: 7 | # adapter: sqlite3 8 | # database: db/development.sqlite3 9 | # pool: 5 10 | # timeout: 5000 11 | 12 | # Warning: The database defined as "test" will be erased and 13 | # re-generated from your development database when you run "rake". 14 | # Do not set this db to the same as development or production. 15 | #test: 16 | # adapter: sqlite3 17 | # database: db/test.sqlite3 18 | # pool: 5 19 | # timeout: 5000 20 | 21 | production: 22 | adapter: sqlite3 23 | database: db/production.sqlite3 24 | pool: 5 25 | timeout: 5000 26 | -------------------------------------------------------------------------------- /rails/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails31::Application.routes.draw do 2 | # The priority is based upon order of creation: 3 | # first created -> highest priority. 4 | 5 | match 'hello' => 'hello#hello' 6 | match 'erb_hello' => 'hello#hellos' 7 | match 'erb_sql' => 'hello#hellodb' 8 | 9 | # Sample of regular route: 10 | # match 'products/:id' => 'catalog#view' 11 | # Keep in mind you can assign values other than :controller and :action 12 | 13 | # Sample of named route: 14 | # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase 15 | # This route can be invoked with purchase_url(:id => product.id) 16 | 17 | # Sample resource route (maps HTTP verbs to controller actions automatically): 18 | # resources :products 19 | 20 | # Sample resource route with options: 21 | # resources :products do 22 | # member do 23 | # get 'short' 24 | # post 'toggle' 25 | # end 26 | # 27 | # collection do 28 | # get 'sold' 29 | # end 30 | # end 31 | 32 | # Sample resource route with sub-resources: 33 | # resources :products do 34 | # resources :comments, :sales 35 | # resource :seller 36 | # end 37 | 38 | # Sample resource route with more complex sub-resources 39 | # resources :products do 40 | # resources :comments 41 | # resources :sales do 42 | # get 'recent', :on => :collection 43 | # end 44 | # end 45 | 46 | # Sample resource route within a namespace: 47 | # namespace :admin do 48 | # # Directs /admin/products/* to Admin::ProductsController 49 | # # (app/controllers/admin/products_controller.rb) 50 | # resources :products 51 | # end 52 | 53 | # You can have the root of your site routed with "root" 54 | # just remember to delete public/index.html. 55 | # root :to => 'welcome#index' 56 | 57 | # See how all your routes lay out with "rake routes" 58 | 59 | # This is a legacy wild controller route that's not recommended for RESTful applications. 60 | # Note: This route will make all actions in every controller accessible via GET requests. 61 | # match ':controller(/:action(/:id(.:format)))' 62 | end 63 | -------------------------------------------------------------------------------- /rails/db/production.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/rails/db/production.sqlite3 -------------------------------------------------------------------------------- /rails/db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /sinatra/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Sinatra test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using Sinatra **v1.2.6** and will likely perform 13 | differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /sinatra/config.ru: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'sinatra' 3 | 4 | 5 | require 'sinatra_app' 6 | run Sinatra::Application 7 | -------------------------------------------------------------------------------- /sinatra/hello.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/sinatra/hello.db -------------------------------------------------------------------------------- /sinatra/sinatra_app.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'sinatra' 3 | require 'sqlite3' 4 | 5 | get '/' do 6 | 'Hello World!' 7 | end 8 | 9 | get '/erb_hello' do 10 | erb :hellos 11 | end 12 | 13 | get '/erb_sql' do 14 | db = SQLite3::Database.new("hello.db") 15 | @data = db.execute("select id, data from hello order by id asc") 16 | erb :hellodb 17 | end 18 | -------------------------------------------------------------------------------- /sinatra/views/hellodb.erb: -------------------------------------------------------------------------------- 1 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

2 | 3 | 4 | <% for row in @data %> 5 | 6 | <% end %> 7 |
<%= row[0] %><%= row[1] %>
8 | -------------------------------------------------------------------------------- /sinatra/views/hellos.erb: -------------------------------------------------------------------------------- 1 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

2 | -------------------------------------------------------------------------------- /sinatra/views/layout.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World 5 | 6 | 7 | 8 | <%= yield :layout %> 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /symfony/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Symfony test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using Symfony **v2.0.1** and will likely perform 13 | differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /symfony/app/Resources/views/base.html.twig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World 6 | 7 | 8 | 9 | {% block body %}{% endblock %} 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /symfony/app/autoload.php: -------------------------------------------------------------------------------- 1 | registerNamespaces(array( 8 | 'Symfony' => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'), 9 | 'Sensio' => __DIR__.'/../vendor/bundles', 10 | 'JMS' => __DIR__.'/../vendor/bundles', 11 | 'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib', 12 | 'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib', 13 | 'Doctrine' => __DIR__.'/../vendor/doctrine/lib', 14 | 'Monolog' => __DIR__.'/../vendor/monolog/src', 15 | 'Assetic' => __DIR__.'/../vendor/assetic/src', 16 | 'Metadata' => __DIR__.'/../vendor/metadata/src', 17 | )); 18 | $loader->registerPrefixes(array( 19 | 'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib', 20 | 'Twig_' => __DIR__.'/../vendor/twig/lib', 21 | )); 22 | 23 | // intl 24 | if (!function_exists('intl_get_error_code')) { 25 | require_once __DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php'; 26 | 27 | $loader->registerPrefixFallbacks(array(__DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs')); 28 | } 29 | 30 | $loader->registerNamespaceFallbacks(array( 31 | __DIR__.'/../src', 32 | )); 33 | $loader->register(); 34 | 35 | AnnotationRegistry::registerLoader(function($class) use ($loader) { 36 | $loader->loadClass($class); 37 | return class_exists($class, false); 38 | }); 39 | AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'); 40 | 41 | // Swiftmailer needs a special autoloader to allow 42 | // the lazy loading of the init file (which is expensive) 43 | require_once __DIR__.'/../vendor/swiftmailer/lib/classes/Swift.php'; 44 | Swift::registerAutoload(__DIR__.'/../vendor/swiftmailer/lib/swift_init.php'); 45 | 46 | require __DIR__.'/../vendor/symfony/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php'; 47 | use Symfony\Component\ClassLoader\ApcUniversalClassLoader; 48 | $loader = new ApcUniversalClassLoader('symfony_2'); 49 | -------------------------------------------------------------------------------- /symfony/app/config/config.yml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: parameters.ini } 3 | - { resource: security.yml } 4 | 5 | framework: 6 | #esi: ~ 7 | #translator: { fallback: %locale% } 8 | secret: %secret% 9 | charset: UTF-8 10 | router: { resource: "%kernel.root_dir%/config/routing.yml" } 11 | form: true 12 | csrf_protection: true 13 | validation: { enable_annotations: true } 14 | templating: { engines: ['twig'] } #assets_version: SomeVersionScheme 15 | session: 16 | default_locale: %locale% 17 | auto_start: true 18 | 19 | # Twig Configuration 20 | twig: 21 | debug: %kernel.debug% 22 | strict_variables: %kernel.debug% 23 | 24 | # Assetic Configuration 25 | assetic: 26 | debug: %kernel.debug% 27 | use_controller: false 28 | filters: 29 | cssrewrite: ~ 30 | # closure: 31 | # jar: %kernel.root_dir%/java/compiler.jar 32 | # yui_css: 33 | # jar: %kernel.root_dir%/java/yuicompressor-2.4.2.jar 34 | 35 | # Doctrine Configuration 36 | doctrine: 37 | dbal: 38 | driver: %database_driver% 39 | host: %database_host% 40 | port: %database_port% 41 | dbname: %database_name% 42 | user: %database_user% 43 | password: %database_password% 44 | path: /var/www/symfony_2/hello.db 45 | charset: UTF8 46 | 47 | orm: 48 | auto_generate_proxy_classes: %kernel.debug% 49 | auto_mapping: true 50 | 51 | # Swiftmailer Configuration 52 | swiftmailer: 53 | transport: %mailer_transport% 54 | host: %mailer_host% 55 | username: %mailer_user% 56 | password: %mailer_password% 57 | 58 | jms_security_extra: 59 | secure_controllers: true 60 | secure_all_services: false 61 | -------------------------------------------------------------------------------- /symfony/app/config/parameters.ini: -------------------------------------------------------------------------------- 1 | [parameters] 2 | database_driver="pdo_sqlite" 3 | database_host="localhost" 4 | database_port="" 5 | database_name="symfony" 6 | database_user="root" 7 | database_password="" 8 | mailer_transport="smtp" 9 | mailer_host="localhost" 10 | mailer_user="" 11 | mailer_password="" 12 | locale="en" 13 | secret="3763470fe3f764deb05e6c358c3b78a54b8ccd71" 14 | -------------------------------------------------------------------------------- /symfony/app/config/routing.yml: -------------------------------------------------------------------------------- 1 | AcmeHelloBundle: 2 | resource: "@AcmeHelloBundle/Resources/config/routing.yml" 3 | prefix: / 4 | 5 | # Internal routing configuration to handle ESI 6 | #_internal: 7 | # resource: "@FrameworkBundle/Resources/config/routing/internal.xml" 8 | # prefix: /_internal 9 | -------------------------------------------------------------------------------- /symfony/hello.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/symfony/hello.db -------------------------------------------------------------------------------- /symfony/src/Acme/HelloBundle/AcmeHelloBundle.php: -------------------------------------------------------------------------------- 1 | render('AcmeHelloBundle:Default:hello.html.twig'); # return $this->render('AcmeHelloBundle:Default:index.html.twig', array('name' => $name)); 19 | # } 20 | } 21 | -------------------------------------------------------------------------------- /symfony/src/Acme/HelloBundle/Controller/HelloController.php: -------------------------------------------------------------------------------- 1 | render('AcmeHelloBundle:Default:hello.html.twig'); # return $this->render('AcmeHelloBundle:Default:index.html.twig', array('name' => $name)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /symfony/src/Acme/HelloBundle/Controller/HellodbController.php: -------------------------------------------------------------------------------- 1 | getDoctrine()->getRepository('AcmeHelloBundle:Hello')->findAll(); 14 | return $this->render('AcmeHelloBundle:Default:hellodb.html.twig', array('data' => $data)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /symfony/src/Acme/HelloBundle/DependencyInjection/AcmeHelloExtension.php: -------------------------------------------------------------------------------- 1 | processConfiguration($configuration, $configs); 24 | 25 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); 26 | $loader->load('services.yml'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /symfony/src/Acme/HelloBundle/DependencyInjection/Configuration.php: -------------------------------------------------------------------------------- 1 | root('acme_hello'); 22 | 23 | // Here you should define the parameters that are allowed to 24 | // configure your bundle. See the documentation linked above for 25 | // more information on that topic. 26 | 27 | return $treeBuilder; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /symfony/src/Acme/HelloBundle/Entity/Hello.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Symfony2 is great 7 | J'aime Symfony2 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /symfony/src/Acme/HelloBundle/Resources/views/Default/hello.html.twig: -------------------------------------------------------------------------------- 1 | {% extends '::base.html.twig' %} 2 | 3 | {% block body %} 4 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

5 | {% endblock %} 6 | -------------------------------------------------------------------------------- /symfony/src/Acme/HelloBundle/Resources/views/Default/hellodb.html.twig: -------------------------------------------------------------------------------- 1 | {% extends '::base.html.twig' %} 2 | 3 | {% block body %} 4 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

5 | 6 | {% for row in data %} 7 | 8 | {% endfor %} 9 |
{{ row.id }}{{ row.data }}
10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /symfony/src/Acme/HelloBundle/Resources/views/Default/index.html.twig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/symfony/src/Acme/HelloBundle/Resources/views/Default/index.html.twig -------------------------------------------------------------------------------- /symfony/src/Acme/HelloBundle/Tests/Controller/DefaultControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/hello/Fabien'); 14 | 15 | $this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/HelloWorld.egg-info/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 1.0 2 | Name: HelloWorld 3 | Version: 0.1dev 4 | Summary: UNKNOWN 5 | Home-page: UNKNOWN 6 | Author: UNKNOWN 7 | Author-email: UNKNOWN 8 | License: UNKNOWN 9 | Description: UNKNOWN 10 | Platform: UNKNOWN 11 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/HelloWorld.egg-info/SOURCES.txt: -------------------------------------------------------------------------------- 1 | MANIFEST.in 2 | README.txt 3 | setup.cfg 4 | setup.py 5 | HelloWorld.egg-info/PKG-INFO 6 | HelloWorld.egg-info/SOURCES.txt 7 | HelloWorld.egg-info/dependency_links.txt 8 | HelloWorld.egg-info/entry_points.txt 9 | HelloWorld.egg-info/paster_plugins.txt 10 | HelloWorld.egg-info/requires.txt 11 | HelloWorld.egg-info/top_level.txt 12 | helloworld/__init__.py 13 | helloworld/config/__init__.py 14 | helloworld/config/app_cfg.py 15 | helloworld/config/environment.py 16 | helloworld/config/middleware.py 17 | helloworld/controllers/__init__.py 18 | helloworld/controllers/error.py 19 | helloworld/controllers/root.py 20 | helloworld/controllers/secure.py 21 | helloworld/controllers/template.py 22 | helloworld/i18n/ru/LC_MESSAGES/helloworld.po 23 | helloworld/lib/__init__.py 24 | helloworld/lib/app_globals.py 25 | helloworld/lib/base.py 26 | helloworld/lib/helpers.py 27 | helloworld/model/__init__.py 28 | helloworld/model/hello.py 29 | helloworld/templates/__init__.py 30 | helloworld/templates/db.html 31 | helloworld/templates/db.jinja 32 | helloworld/templates/db.mak 33 | helloworld/templates/hello.html 34 | helloworld/templates/hello.jinja 35 | helloworld/templates/hello.mak 36 | helloworld/templates/master.html 37 | helloworld/templates/master.jinja 38 | helloworld/templates/master.mak 39 | helloworld/tests/__init__.py 40 | helloworld/tests/functional/__init__.py 41 | helloworld/tests/functional/test_authentication.py 42 | helloworld/tests/functional/test_root.py 43 | helloworld/tests/models/__init__.py 44 | helloworld/tests/models/test_auth.py 45 | helloworld/websetup/__init__.py 46 | helloworld/websetup/bootstrap.py 47 | helloworld/websetup/schema.py -------------------------------------------------------------------------------- /turbogears/HelloWorld/HelloWorld.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/HelloWorld.egg-info/entry_points.txt: -------------------------------------------------------------------------------- 1 | 2 | [paste.app_factory] 3 | main = helloworld.config.middleware:make_app 4 | 5 | [paste.app_install] 6 | main = pylons.util:PylonsInstaller 7 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/HelloWorld.egg-info/paster_plugins.txt: -------------------------------------------------------------------------------- 1 | PasteScript 2 | Pylons 3 | TurboGears2 4 | tg.devtools 5 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/HelloWorld.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | TurboGears2 >= 2.0b7 2 | Babel >=0.9.4 3 | zope.sqlalchemy >= 0.4 4 | repoze.tm2 >= 1.0a4 5 | jinja2 -------------------------------------------------------------------------------- /turbogears/HelloWorld/HelloWorld.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | helloworld 2 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include helloworld/public * 2 | include helloworld/public/favicon.ico 3 | recursive-include helloworld/i18n * 4 | recursive-include helloworld/templates * 5 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/README.txt: -------------------------------------------------------------------------------- 1 | This file is for you to describe the HelloWorld application. Typically 2 | you would include information such as the information below: 3 | 4 | Installation and Setup 5 | ====================== 6 | 7 | Install ``HelloWorld`` using the setup.py script:: 8 | 9 | $ cd HelloWorld 10 | $ python setup.py install 11 | 12 | Create the project database for any model classes defined:: 13 | 14 | $ paster setup-app development.ini 15 | 16 | Start the paste http server:: 17 | 18 | $ paster serve development.ini 19 | 20 | While developing you may want the server to reload after changes in package files (or its dependencies) are saved. This can be achieved easily by adding the --reload option:: 21 | 22 | $ paster serve --reload development.ini 23 | 24 | Then you are ready to go. 25 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/development.ini: -------------------------------------------------------------------------------- 1 | # 2 | # HelloWorld - Pylons development environment configuration 3 | # 4 | # The %(here)s variable will be replaced with the parent directory of this file 5 | # 6 | # This file is for deployment specific config options -- other configuration 7 | # that is always required for the app is done in the config directory, 8 | # and generally should not be modified by end users. 9 | 10 | [DEFAULT] 11 | debug = true 12 | # Uncomment and replace with the address which should receive any error reports 13 | #email_to = you@yourdomain.com 14 | smtp_server = localhost 15 | error_email_from = paste@localhost 16 | 17 | [server:main] 18 | use = egg:Paste#http 19 | host = 127.0.0.1 20 | port = 8080 21 | 22 | [app:main] 23 | use = egg:HelloWorld 24 | full_stack = true 25 | #lang = ru 26 | cache_dir = %(here)s/data 27 | beaker.session.key = helloworld 28 | beaker.session.secret = somesecret 29 | 30 | # If you'd like to fine-tune the individual locations of the cache data dirs 31 | # for the Cache data, or the Session saves, un-comment the desired settings 32 | # here: 33 | #beaker.cache.data_dir = %(here)s/data/cache 34 | #beaker.session.data_dir = %(here)s/data/sessions 35 | 36 | # pick the form for your database 37 | # %(here) may include a ':' character on Windows environments; this can 38 | # invalidate the URI when specifying a SQLite db via path name 39 | # sqlalchemy.url=postgres://username:password@hostname:port/databasename 40 | # sqlalchemy.url=mysql://username:password@hostname:port/databasename 41 | 42 | 43 | # If you have sqlite, here's a simple default to get you started 44 | # in development 45 | 46 | sqlalchemy.url = sqlite:///%(here)s/devdata.db 47 | #echo shouldn't be used together with the logging module. 48 | sqlalchemy.echo = false 49 | sqlalchemy.echo_pool = false 50 | sqlalchemy.pool_recycle = 3600 51 | 52 | # if you are using Mako and want to be able to reload 53 | # the mako template from disk during the development phase 54 | # you should say 'true' here 55 | # This option is only used for mako templating engine 56 | # WARNING: if you want to deploy your application using a zipped egg 57 | # (ie: if your application's setup.py defines zip-safe=True, then you 58 | # MUST put "false" for the production environment because there will 59 | # be no disk and real files to compare time with. 60 | # On the contrary if your application defines zip-safe=False and is 61 | # deployed in an unzipped manner, then you can leave this option to true 62 | templating.mako.reloadfromdisk = true 63 | 64 | # the compiled template dir is a directory that must be readable by your 65 | # webserver. It will be used to store the resulting templates once compiled 66 | # by the TemplateLookup system. 67 | # During development you generally don't need this option since paste's HTTP 68 | # server will have access to you development directories, but in production 69 | # you'll most certainly want to have apache or nginx to write in a directory 70 | # that does not contain any source code in any form for obvious security reasons. 71 | # 72 | #templating.mako.compiled_templates_dir = /some/dir/where/webserver/has/access 73 | 74 | # WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* 75 | # Debug mode will enable the interactive debugging tool, allowing ANYONE to 76 | # execute malicious code after an exception is raised. 77 | #set debug = false 78 | 79 | # Logging configuration 80 | # Add additional loggers, handlers, formatters here 81 | # Uses python's logging config file format 82 | # http://docs.python.org/lib/logging-config-fileformat.html 83 | 84 | [loggers] 85 | keys = root, helloworld, sqlalchemy 86 | 87 | [handlers] 88 | keys = console 89 | 90 | [formatters] 91 | keys = generic 92 | 93 | # If you create additional loggers, add them as a key to [loggers] 94 | [logger_root] 95 | level = INFO 96 | handlers = console 97 | 98 | [logger_helloworld] 99 | level = DEBUG 100 | handlers = 101 | qualname = helloworld 102 | 103 | [logger_sqlalchemy] 104 | level = INFO 105 | handlers = 106 | qualname = sqlalchemy.engine 107 | # "level = INFO" logs SQL queries. 108 | # "level = DEBUG" logs SQL queries and results. 109 | # "level = WARN" logs neither. (Recommended for production systems.) 110 | 111 | 112 | # If you create additional handlers, add them as a key to [handlers] 113 | [handler_console] 114 | class = StreamHandler 115 | args = (sys.stderr,) 116 | level = NOTSET 117 | formatter = generic 118 | 119 | # If you create additional formatters, add them as a key to [formatters] 120 | [formatter_generic] 121 | format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s 122 | datefmt = %H:%M:%S 123 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/ez_setup/README.txt: -------------------------------------------------------------------------------- 1 | This directory exists so that Subversion-based projects can share a single 2 | copy of the ``ez_setup`` bootstrap module for ``setuptools``, and have it 3 | automatically updated in their projects when ``setuptools`` is updated. 4 | 5 | For your convenience, you may use the following svn:externals definition:: 6 | 7 | ez_setup svn://svn.eby-sarna.com/svnroot/ez_setup 8 | 9 | You can set this by executing this command in your project directory:: 10 | 11 | svn propedit svn:externals . 12 | 13 | And then adding the line shown above to the file that comes up for editing. 14 | Then, whenever you update your project, ``ez_setup`` will be updated as well. 15 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/ez_setup/__init__.py: -------------------------------------------------------------------------------- 1 | #!python 2 | """Bootstrap setuptools installation 3 | 4 | If you want to use setuptools in your package's setup.py, just include this 5 | file in the same directory with it, and add this to the top of your setup.py:: 6 | 7 | from ez_setup import use_setuptools 8 | use_setuptools() 9 | 10 | If you want to require a specific version of setuptools, set a download 11 | mirror, or use an alternate download directory, you can do so by supplying 12 | the appropriate options to ``use_setuptools()``. 13 | 14 | This file can also be run as a script to install or upgrade setuptools. 15 | """ 16 | import sys 17 | DEFAULT_VERSION = "0.6c7" 18 | DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3] 19 | 20 | md5_data = { 21 | 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca', 22 | 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb', 23 | 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b', 24 | 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a', 25 | 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618', 26 | 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac', 27 | 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5', 28 | 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4', 29 | 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c', 30 | 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b', 31 | 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27', 32 | 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277', 33 | 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa', 34 | 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e', 35 | 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e', 36 | 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f', 37 | 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2', 38 | 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc', 39 | 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167', 40 | 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64', 41 | 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d', 42 | 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20', 43 | 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab', 44 | 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53', 45 | 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2', 46 | 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e', 47 | 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372', 48 | } 49 | 50 | import sys, os 51 | 52 | def _validate_md5(egg_name, data): 53 | if egg_name in md5_data: 54 | from md5 import md5 55 | digest = md5(data).hexdigest() 56 | if digest != md5_data[egg_name]: 57 | print >>sys.stderr, ( 58 | "md5 validation of %s failed! (Possible download problem?)" 59 | % egg_name 60 | ) 61 | sys.exit(2) 62 | return data 63 | 64 | 65 | def use_setuptools( 66 | version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, 67 | download_delay=15 68 | ): 69 | """Automatically find/download setuptools and make it available on sys.path 70 | 71 | `version` should be a valid setuptools version number that is available 72 | as an egg for download under the `download_base` URL (which should end with 73 | a '/'). `to_dir` is the directory where setuptools will be downloaded, if 74 | it is not already available. If `download_delay` is specified, it should 75 | be the number of seconds that will be paused before initiating a download, 76 | should one be required. If an older version of setuptools is installed, 77 | this routine will print a message to ``sys.stderr`` and raise SystemExit in 78 | an attempt to abort the calling script. 79 | """ 80 | try: 81 | import setuptools 82 | if setuptools.__version__ == '0.0.1': 83 | print >>sys.stderr, ( 84 | "You have an obsolete version of setuptools installed. Please\n" 85 | "remove it from your system entirely before rerunning this script." 86 | ) 87 | sys.exit(2) 88 | except ImportError: 89 | egg = download_setuptools(version, download_base, to_dir, download_delay) 90 | sys.path.insert(0, egg) 91 | import setuptools; setuptools.bootstrap_install_from = egg 92 | 93 | import pkg_resources 94 | try: 95 | pkg_resources.require("setuptools>="+version) 96 | 97 | except pkg_resources.VersionConflict, e: 98 | # XXX could we install in a subprocess here? 99 | print >>sys.stderr, ( 100 | "The required version of setuptools (>=%s) is not available, and\n" 101 | "can't be installed while this script is running. Please install\n" 102 | " a more recent version first.\n\n(Currently using %r)" 103 | ) % (version, e.args[0]) 104 | sys.exit(2) 105 | 106 | def download_setuptools( 107 | version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, 108 | delay = 15 109 | ): 110 | """Download setuptools from a specified location and return its filename 111 | 112 | `version` should be a valid setuptools version number that is available 113 | as an egg for download under the `download_base` URL (which should end 114 | with a '/'). `to_dir` is the directory where the egg will be downloaded. 115 | `delay` is the number of seconds to pause before an actual download attempt. 116 | """ 117 | import urllib2, shutil 118 | egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3]) 119 | url = download_base + egg_name 120 | saveto = os.path.join(to_dir, egg_name) 121 | src = dst = None 122 | if not os.path.exists(saveto): # Avoid repeated downloads 123 | try: 124 | from distutils import log 125 | if delay: 126 | log.warn(""" 127 | --------------------------------------------------------------------------- 128 | This script requires setuptools version %s to run (even to display 129 | help). I will attempt to download it for you (from 130 | %s), but 131 | you may need to enable firewall access for this script first. 132 | I will start the download in %d seconds. 133 | 134 | (Note: if this machine does not have network access, please obtain the file 135 | 136 | %s 137 | 138 | and place it in this directory before rerunning this script.) 139 | ---------------------------------------------------------------------------""", 140 | version, download_base, delay, url 141 | ); from time import sleep; sleep(delay) 142 | log.warn("Downloading %s", url) 143 | src = urllib2.urlopen(url) 144 | # Read/write all in one block, so we don't create a corrupt file 145 | # if the download is interrupted. 146 | data = _validate_md5(egg_name, src.read()) 147 | dst = open(saveto,"wb"); dst.write(data) 148 | finally: 149 | if src: src.close() 150 | if dst: dst.close() 151 | return os.path.realpath(saveto) 152 | 153 | def main(argv, version=DEFAULT_VERSION): 154 | """Install or upgrade setuptools and EasyInstall""" 155 | 156 | try: 157 | import setuptools 158 | except ImportError: 159 | egg = None 160 | try: 161 | egg = download_setuptools(version, delay=0) 162 | sys.path.insert(0,egg) 163 | from setuptools.command.easy_install import main 164 | return main(list(argv)+[egg]) # we're done here 165 | finally: 166 | if egg and os.path.exists(egg): 167 | os.unlink(egg) 168 | else: 169 | if setuptools.__version__ == '0.0.1': 170 | # tell the user to uninstall obsolete version 171 | use_setuptools(version) 172 | 173 | req = "setuptools>="+version 174 | import pkg_resources 175 | try: 176 | pkg_resources.require(req) 177 | except pkg_resources.VersionConflict: 178 | try: 179 | from setuptools.command.easy_install import main 180 | except ImportError: 181 | from easy_install import main 182 | main(list(argv)+[download_setuptools(delay=0)]) 183 | sys.exit(0) # try to force an exit 184 | else: 185 | if argv: 186 | from setuptools.command.easy_install import main 187 | main(argv) 188 | else: 189 | print "Setuptools version",version,"or greater has been installed." 190 | print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)' 191 | 192 | 193 | 194 | def update_md5(filenames): 195 | """Update our built-in md5 registry""" 196 | 197 | import re 198 | from md5 import md5 199 | 200 | for name in filenames: 201 | base = os.path.basename(name) 202 | f = open(name,'rb') 203 | md5_data[base] = md5(f.read()).hexdigest() 204 | f.close() 205 | 206 | data = [" %r: %r,\n" % it for it in md5_data.items()] 207 | data.sort() 208 | repl = "".join(data) 209 | 210 | import inspect 211 | srcfile = inspect.getsourcefile(sys.modules[__name__]) 212 | f = open(srcfile, 'rb'); src = f.read(); f.close() 213 | 214 | match = re.search("\nmd5_data = {\n([^}]+)}", src) 215 | if not match: 216 | print >>sys.stderr, "Internal error!" 217 | sys.exit(2) 218 | 219 | src = src[:match.start(1)] + repl + src[match.end(1):] 220 | f = open(srcfile,'w') 221 | f.write(src) 222 | f.close() 223 | 224 | 225 | if __name__=='__main__': 226 | if len(sys.argv)>2 and sys.argv[1]=='--md5update': 227 | update_md5(sys.argv[2:]) 228 | else: 229 | main(sys.argv[1:]) 230 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/hello.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/turbogears/HelloWorld/hello.db -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """The HelloWorld package""" 3 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/config/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/config/app_cfg.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Global configuration file for TG2-specific settings in HelloWorld. 4 | 5 | This file complements development/deployment.ini. 6 | 7 | Please note that **all the argument values are strings**. If you want to 8 | convert them into boolean, for example, you should use the 9 | :func:`paste.deploy.converters.asbool` function, as in:: 10 | 11 | from paste.deploy.converters import asbool 12 | setting = asbool(global_conf.get('the_setting')) 13 | 14 | """ 15 | 16 | from tg.configuration import AppConfig 17 | 18 | import helloworld 19 | from helloworld import model 20 | from helloworld.lib import app_globals, helpers 21 | 22 | base_config = AppConfig() 23 | base_config.renderers = [] 24 | 25 | base_config.package = helloworld 26 | 27 | base_config.use_dotted_templatenames = False 28 | base_config.default_renderer = 'jinja' 29 | base_config.renderers.append('jinja') 30 | #base_config.renderers.append('genshi') 31 | #base_config.renderers.append('mako') 32 | #base_config.renderers.append('json') 33 | 34 | #Configure the base SQLALchemy Setup 35 | base_config.use_sqlalchemy = True 36 | base_config.model = helloworld.model 37 | base_config.DBSession = helloworld.model.DBSession 38 | 39 | #No need for tosca in this test app 40 | base_config.use_toscawidgets = False 41 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/config/deployment.ini: -------------------------------------------------------------------------------- 1 | # 2 | # HelloWorld - TurboGears configuration 3 | # 4 | # The %(here)s variable will be replaced with the parent directory of this file 5 | # 6 | [DEFAULT] 7 | # WARGING == If debug is not set to false, you'll get the interactive 8 | # debugger on production, which is a huge security hole. 9 | 10 | debug = false 11 | email_to = you@yourdomain.com 12 | smtp_server = localhost 13 | error_email_from = paste@localhost 14 | 15 | [server:main] 16 | use = egg:Paste#http 17 | host = 0.0.0.0 18 | port = 8080 19 | 20 | [app:main] 21 | use = egg:HelloWorld 22 | full_stack = true 23 | cache_dir = %(here)s/data 24 | beaker.session.key = helloworld 25 | beaker.session.secret = ${app_instance_secret} 26 | app_instance_uuid = ${app_instance_uuid} 27 | 28 | # If you'd like to fine-tune the individual locations of the cache data dirs 29 | # for the Cache data, or the Session saves, un-comment the desired settings 30 | # here: 31 | #beaker.cache.data_dir = %(here)s/data/cache 32 | #beaker.session.data_dir = %(here)s/data/sessions 33 | # Specify the database for SQLAlchemy to use via 34 | # turbogears.database 35 | # %(here) may include a ':' character on Windows environments; this can 36 | # invalidate the URI when specifying a SQLite db via path name 37 | sqlalchemy.url = sqlite:///%(here)s/hello.db 38 | sqlalchemy.echo = False 39 | 40 | # WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* 41 | # Debug mode will enable the interactive debugging tool, allowing ANYONE to 42 | # execute malicious code after an exception is raised. 43 | set debug = false 44 | 45 | # Logging configuration 46 | # Add additional loggers, handlers, formatters here 47 | # Uses python's logging config file format 48 | # http://docs.python.org/lib/logging-config-fileformat.html 49 | 50 | [loggers] 51 | keys = root, helloworld, sqlalchemy 52 | 53 | [handlers] 54 | keys = console 55 | 56 | [formatters] 57 | keys = generic 58 | 59 | # If you create additional loggers, add them as a key to [loggers] 60 | [logger_root] 61 | level = WARN 62 | handlers = console 63 | 64 | [logger_helloworld] 65 | level = WARN 66 | handlers = 67 | qualname = helloworld 68 | 69 | [logger_sqlalchemy] 70 | level = WARN 71 | handlers = 72 | qualname = sqlalchemy.engine 73 | # "level = INFO" logs SQL queries. 74 | # "level = DEBUG" logs SQL queries and results. 75 | # "level = WARN" logs neither. (Recommended for production systems.) 76 | 77 | 78 | # If you create additional handlers, add them as a key to [handlers] 79 | [handler_console] 80 | class = StreamHandler 81 | args = (sys.stderr,) 82 | level = NOTSET 83 | formatter = generic 84 | 85 | # If you create additional formatters, add them as a key to [formatters] 86 | [formatter_generic] 87 | format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s 88 | datefmt = %H:%M:%S 89 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/config/environment.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """WSGI environment setup for HelloWorld.""" 3 | 4 | from helloworld.config.app_cfg import base_config 5 | 6 | __all__ = ['load_environment'] 7 | 8 | #Use base_config to setup the environment loader function 9 | load_environment = base_config.make_load_environment() 10 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/config/middleware.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """WSGI middleware initialization for the HelloWorld application.""" 3 | 4 | from helloworld.config.app_cfg import base_config 5 | from helloworld.config.environment import load_environment 6 | 7 | 8 | __all__ = ['make_app'] 9 | 10 | # Use base_config to setup the necessary PasteDeploy application factory. 11 | # make_base_app will wrap the TG2 app with all the middleware it needs. 12 | make_base_app = base_config.setup_tg_wsgi_app(load_environment) 13 | 14 | 15 | def make_app(global_conf, full_stack=False, **app_conf): 16 | """ 17 | Set HelloWorld up with the settings found in the PasteDeploy configuration 18 | file used. 19 | 20 | :param global_conf: The global settings for HelloWorld (those 21 | defined under the ``[DEFAULT]`` section). 22 | :type global_conf: dict 23 | :param full_stack: Should the whole TG2 stack be set up? 24 | :type full_stack: str or bool 25 | :return: The HelloWorld application with all the relevant middleware 26 | loaded. 27 | 28 | This is the PasteDeploy factory for the HelloWorld application. 29 | 30 | ``app_conf`` contains all the application-specific settings (those defined 31 | under ``[app:main]``. 32 | 33 | 34 | """ 35 | app = make_base_app(global_conf, full_stack=False, **app_conf) 36 | 37 | # Wrap your base TurboGears 2 application with custom middleware here 38 | 39 | return app 40 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/controllers/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Controllers for the HelloWorld application.""" 3 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/controllers/controller.template: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Sample controller module""" 3 | 4 | # turbogears imports 5 | from tg import expose 6 | #from tg import redirect, validate, flash 7 | 8 | # third party imports 9 | #from pylons.i18n import ugettext as _ 10 | #from repoze.what import predicates 11 | 12 | # project specific imports 13 | from helloworld.lib.base import BaseController 14 | #from helloworld.model import DBSession, metadata 15 | 16 | 17 | class SampleController(BaseController): 18 | 19 | @expose('helloworld.templates.index') 20 | def index(self): 21 | return dict(page='index') 22 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/controllers/error.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Error controller""" 3 | 4 | from tg import request, expose 5 | 6 | __all__ = ['ErrorController'] 7 | 8 | 9 | class ErrorController(object): 10 | """ 11 | Generates error documents as and when they are required. 12 | 13 | The ErrorDocuments middleware forwards to ErrorController when error 14 | related status codes are returned from the application. 15 | 16 | This behaviour can be altered by changing the parameters to the 17 | ErrorDocuments middleware in your config/middleware.py file. 18 | 19 | """ 20 | 21 | @expose('helloworld.templates.error') 22 | def document(self, *args, **kwargs): 23 | """Render the error document""" 24 | resp = request.environ.get('pylons.original_response') 25 | default_message = ("

We're sorry but we weren't able to process " 26 | " this request.

") 27 | values = dict(prefix=request.environ.get('SCRIPT_NAME', ''), 28 | code=request.params.get('code', resp.status_int), 29 | message=request.params.get('message', default_message)) 30 | return values 31 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/controllers/root.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Main Controller""" 3 | 4 | from tg import expose 5 | 6 | from helloworld.lib.base import BaseController 7 | from helloworld.model import DBSession, metadata 8 | from helloworld.controllers.error import ErrorController 9 | from helloworld import model 10 | 11 | __all__ = ['RootController'] 12 | 13 | 14 | class RootController(BaseController): 15 | 16 | # RAW STRING TEST 17 | @expose() 18 | def index(self): 19 | """Handle the front-page.""" 20 | return 'Hello World!' 21 | 22 | 23 | # TEMPLATE TESTS 24 | # @expose('genshi:helloworld.templates.hello') 25 | # def genshi_hello(self): 26 | # return dict() 27 | 28 | # @expose('mako:hello.mak') 29 | # def mako_hello(self): 30 | # return dict() 31 | 32 | @expose('jinja:hello.jinja') 33 | def jinja_hello(self): 34 | return dict() 35 | 36 | 37 | # DATABASE TESTS 38 | @expose() 39 | def raw_sql(self): 40 | output = [] 41 | hello = DBSession.query(model.Hello).all() 42 | for row in hello: 43 | output.append('%s - %s' % (row.id, row.data)) 44 | return '\n'.join(output) 45 | 46 | # @expose('genshi:helloworld.templates.db') 47 | # def genshi_sql(self): 48 | # hello = DBSession.query(model.Hello).all() 49 | # return dict(hello=hello) 50 | 51 | # @expose('mako:db.mak') 52 | # def mako_sql(self): 53 | # hello = DBSession.query(model.Hello).all() 54 | # return dict(hello=hello) 55 | 56 | @expose('jinja:db.jinja') 57 | def jinja_sql(self): 58 | hello = DBSession.query(model.Hello).all() 59 | return dict(hello=hello) 60 | 61 | 62 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/controllers/secure.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Sample controller with all its actions protected.""" 3 | 4 | # This controller is only used when you activate auth. You can safely remove 5 | # this file from your project. 6 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/controllers/template.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Fallback controller.""" 3 | 4 | from helloworld.lib.base import BaseController 5 | 6 | __all__ = ['TemplateController'] 7 | 8 | 9 | class TemplateController(BaseController): 10 | """ 11 | The fallback controller for HelloWorld. 12 | 13 | By default, the final controller tried to fulfill the request 14 | when no other routes match. It may be used to display a template 15 | when all else fails, e.g.:: 16 | 17 | def view(self, url): 18 | return render('/%s' % url) 19 | 20 | Or if you're using Mako and want to explicitly send a 404 (Not 21 | Found) response code when the requested template doesn't exist:: 22 | 23 | import mako.exceptions 24 | 25 | def view(self, url): 26 | try: 27 | return render('/%s' % url) 28 | except mako.exceptions.TopLevelLookupException: 29 | abort(404) 30 | 31 | """ 32 | 33 | def view(self, url): 34 | """Abort the request with a 404 HTTP status code.""" 35 | abort(404) 36 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/i18n/ru/LC_MESSAGES/helloworld.po: -------------------------------------------------------------------------------- 1 | # Russian translations for ${package}. 2 | # Copyright (C) 2008 ORGANIZATION 3 | # This file is distributed under the same license as the ${package} project. 4 | # FIRST AUTHOR , 2008. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: ${package} 0.0.0\n" 9 | "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" 10 | "POT-Creation-Date: 2008-01-13 14:00+0200\n" 11 | "PO-Revision-Date: 2008-01-13 14:00+0200\n" 12 | "Last-Translator: FULL NAME \n" 13 | "Language-Team: ru \n" 14 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " 15 | "n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=utf-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Generated-By: Babel 0.9.1\n" 20 | 21 | #: ${package}/controllers/root.py:13 22 | msgid "Your application is now running" 23 | msgstr "Ваши приложение успешно запущено" 24 | 25 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/lib/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/lib/app_globals.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """The application's Globals object""" 4 | 5 | __all__ = ['Globals'] 6 | 7 | 8 | class Globals(object): 9 | """Container for objects available throughout the life of the application. 10 | 11 | One instance of Globals is created during application initialization and 12 | is available during requests via the 'app_globals' variable. 13 | 14 | """ 15 | 16 | def __init__(self): 17 | """Do nothing, by default.""" 18 | pass 19 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/lib/base.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """The base Controller API.""" 4 | 5 | from tg import TGController, tmpl_context 6 | from tg.render import render 7 | from pylons.i18n import _, ungettext, N_ 8 | #from tw.api import WidgetBunch 9 | import helloworld.model as model 10 | 11 | __all__ = ['BaseController'] 12 | 13 | 14 | class BaseController(TGController): 15 | """ 16 | Base class for the controllers in the application. 17 | 18 | Your web application should have one of these. The root of 19 | your application is used to compute URLs used by your app. 20 | 21 | """ 22 | 23 | def __call__(self, environ, start_response): 24 | """Invoke the Controller""" 25 | # TGController.__call__ dispatches to the Controller method 26 | # the request is routed to. This routing information is 27 | # available in environ['pylons.routes_dict'] 28 | 29 | return TGController.__call__(self, environ, start_response) 30 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/lib/helpers.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """WebHelpers used in HelloWorld.""" 4 | 5 | #from webhelpers import date, feedgenerator, html, number, misc, text 6 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/model/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """The application's model objects""" 3 | 4 | from zope.sqlalchemy import ZopeTransactionExtension 5 | from sqlalchemy.orm import scoped_session, sessionmaker 6 | #from sqlalchemy import MetaData 7 | from sqlalchemy.ext.declarative import declarative_base 8 | 9 | # Global session manager: DBSession() returns the Thread-local 10 | # session object appropriate for the current web request. 11 | maker = sessionmaker(autoflush=True, autocommit=False, 12 | extension=ZopeTransactionExtension()) 13 | DBSession = scoped_session(maker) 14 | 15 | # Base class for all of our model classes: By default, the data model is 16 | # defined with SQLAlchemy's declarative extension, but if you need more 17 | # control, you can switch to the traditional method. 18 | DeclarativeBase = declarative_base() 19 | 20 | # There are two convenient ways for you to spare some typing. 21 | # You can have a query property on all your model classes by doing this: 22 | # DeclarativeBase.query = DBSession.query_property() 23 | # Or you can use a session-aware mapper as it was used in TurboGears 1: 24 | # DeclarativeBase = declarative_base(mapper=DBSession.mapper) 25 | 26 | # Global metadata. 27 | # The default metadata is the one from the declarative base. 28 | metadata = DeclarativeBase.metadata 29 | 30 | # If you have multiple databases with overlapping table names, you'll need a 31 | # metadata for each database. Feel free to rename 'metadata2'. 32 | #metadata2 = MetaData() 33 | 34 | ##### 35 | # Generally you will not want to define your table's mappers, and data objects 36 | # here in __init__ but will want to create modules them in the model directory 37 | # and import them at the bottom of this file. 38 | # 39 | ###### 40 | 41 | def init_model(engine): 42 | """Call me before using any of the tables or classes in the model.""" 43 | 44 | DBSession.configure(bind=engine) 45 | # If you are using reflection to introspect your database and create 46 | # table objects for you, your tables must be defined and mapped inside 47 | # the init_model function, so that the engine is available if you 48 | # use the model outside tg2, you need to make sure this is called before 49 | # you use the model. 50 | 51 | # 52 | # See the following example: 53 | 54 | #global t_reflected 55 | 56 | #t_reflected = Table("Reflected", metadata, 57 | # autoload=True, autoload_with=engine) 58 | 59 | #mapper(Reflected, t_reflected) 60 | 61 | # Import your model modules here. 62 | from helloworld.model.hello import Hello 63 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/model/hello.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Sample model module.""" 3 | 4 | from sqlalchemy import * 5 | from sqlalchemy.orm import mapper, relation 6 | from sqlalchemy import Table, ForeignKey, Column 7 | from sqlalchemy.types import Integer, Unicode 8 | #from sqlalchemy.orm import relation, backref 9 | 10 | from helloworld.model import DeclarativeBase, metadata, DBSession 11 | 12 | 13 | class Hello(DeclarativeBase): 14 | __tablename__ = 'hello' 15 | 16 | def __init__(self, id, data): 17 | self.id = id 18 | self.data = data 19 | 20 | #{ Columns 21 | 22 | id = Column(Integer, primary_key=True) 23 | data = Column(Unicode(255), nullable=False) 24 | 25 | #} 26 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/model/model.template: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Sample model module.""" 3 | 4 | from sqlalchemy import * 5 | from sqlalchemy.orm import mapper, relation 6 | from sqlalchemy import Table, ForeignKey, Column 7 | from sqlalchemy.types import Integer, Unicode 8 | #from sqlalchemy.orm import relation, backref 9 | 10 | from helloworld.model import DeclarativeBase, metadata, DBSession 11 | 12 | 13 | class SampleModel(DeclarativeBase): 14 | __tablename__ = 'sample_model' 15 | 16 | #{ Columns 17 | 18 | id = Column(Integer, primary_key=True) 19 | 20 | data = Column(Unicode(255), nullable=False) 21 | 22 | #} 23 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/templates/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Templates package for the application.""" 3 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/templates/db.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

8 | 9 | 10 | 11 | 12 | 13 |
${row.id}${row.data}
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/templates/db.jinja: -------------------------------------------------------------------------------- 1 | {% extends "master.jinja" %} 2 | {% block content %} 3 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

4 | 5 | 6 | {% for row in hello %} 7 | 8 | {% endfor %} 9 |
{{ row.id }}{{ row.data }}
10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/templates/db.mak: -------------------------------------------------------------------------------- 1 | <%inherit file="master.mak"/> 2 | <%def name="content()">\ 3 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

4 | 5 | 6 | % for row in hello: 7 | 8 | % endfor 9 |
${ row.id }${ row.data }
10 | 11 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/templates/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

8 | 9 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/templates/hello.jinja: -------------------------------------------------------------------------------- 1 | {% extends "master.jinja" %} 2 | {% block content %} 3 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

4 | 5 | {# 6 | 7 | {% for k, v in request.environ.iteritems() %} 8 | 9 | {% endfor %} 10 |
{{ k | escape }}{{ v | escape }}
11 | #} 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/templates/hello.mak: -------------------------------------------------------------------------------- 1 | <%inherit file="master.mak"/> 2 | <%def name="content()">\ 3 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

4 | 5 | ## 6 | ## % for k, v in request.environ.iteritems(): 7 | ## 8 | ## % endfor 9 | ##
${ k | h }${ v | h }
10 | 11 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/templates/master.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | Hello World 6 | 7 | 8 | 9 | ${select('*|text()')} 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/templates/master.jinja: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World 5 | 6 | 7 | {% block content %}{% endblock %} 8 | 9 | 10 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/templates/master.mak: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | 4 | 5 | Hello World 6 | 7 | 8 | ${self.content()} 9 | 10 | 11 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Unit and functional test suite for HelloWorld.""" 3 | 4 | from os import path 5 | import sys 6 | 7 | from tg import config 8 | from paste.deploy import loadapp 9 | from paste.script.appinstall import SetupCommand 10 | from routes import url_for 11 | from webtest import TestApp 12 | from nose.tools import eq_ 13 | 14 | from helloworld import model 15 | 16 | __all__ = ['setup_db', 'teardown_db', 'TestController', 'url_for'] 17 | 18 | def setup_db(): 19 | """Method used to build a database""" 20 | engine = config['pylons.app_globals'].sa_engine 21 | model.init_model(engine) 22 | model.metadata.create_all(engine) 23 | 24 | def teardown_db(): 25 | """Method used to destroy a database""" 26 | engine = config['pylons.app_globals'].sa_engine 27 | model.metadata.drop_all(engine) 28 | 29 | 30 | class TestController(object): 31 | """ 32 | Base functional test case for the controllers. 33 | 34 | The HelloWorld application instance (``self.app``) set up in this test 35 | case (and descendants) has authentication disabled, so that developers can 36 | test the protected areas independently of the :mod:`repoze.who` plugins 37 | used initially. This way, authentication can be tested once and separately. 38 | 39 | Check helloworld.tests.functional.test_authentication for the repoze.who 40 | integration tests. 41 | 42 | This is the officially supported way to test protected areas with 43 | repoze.who-testutil (http://code.gustavonarea.net/repoze.who-testutil/). 44 | 45 | """ 46 | 47 | application_under_test = 'main_without_authn' 48 | 49 | def setUp(self): 50 | """Method called by nose before running each test""" 51 | # Loading the application: 52 | conf_dir = config.here 53 | wsgiapp = loadapp('config:test.ini#%s' % self.application_under_test, 54 | relative_to=conf_dir) 55 | self.app = TestApp(wsgiapp) 56 | # Setting it up: 57 | test_file = path.join(conf_dir, 'test.ini') 58 | cmd = SetupCommand('setup-app') 59 | cmd.run([test_file]) 60 | 61 | def tearDown(self): 62 | """Method called by nose after running each test""" 63 | # Cleaning up the database: 64 | teardown_db() 65 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/tests/functional/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Functional test suite for the controllers of the application.""" -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/tests/functional/test_authentication.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/tests/functional/test_root.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Functional test suite for the root controller. 4 | 5 | This is an example of how functional tests can be written for controllers. 6 | 7 | As opposed to a unit-test, which test a small unit of functionality, 8 | functional tests exercise the whole application and its WSGI stack. 9 | 10 | Please read http://pythonpaste.org/webtest/ for more information. 11 | 12 | """ 13 | from nose.tools import assert_true 14 | 15 | from helloworld.tests import TestController 16 | 17 | 18 | class TestRootController(TestController): 19 | def test_index(self): 20 | response = self.app.get('/') 21 | msg = 'TurboGears 2 is rapid web application development toolkit '\ 22 | 'designed to make your life easier.' 23 | # You can look for specific strings: 24 | assert_true(msg in response) 25 | 26 | # You can also access a BeautifulSoup'ed response in your tests 27 | # (First run $ easy_install BeautifulSoup 28 | # and then uncomment the next two lines) 29 | 30 | #links = response.html.findAll('a') 31 | #print links 32 | #assert_true(links, "Mummy, there are no links here!") 33 | 34 | def test_environ(self): 35 | response = self.app.get('/environ.html') 36 | assert_true('The keys in the environment are: ' in response) 37 | 38 | def test_data(self): 39 | response = self.app.get('/data.html?a=1&b=2') 40 | expected = """\ 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
a1
b2
51 | """ 52 | assert expected in response, response 53 | 54 | def test_data_json(self): 55 | resp = self.app.get('/data.json?a=1&b=2') 56 | assert '"a": "1", "b": "2"' in resp, resp 57 | 58 | 59 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/tests/models/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Unit test suite for the models of the application.""" 3 | from nose.tools import assert_equals 4 | 5 | from helloworld.model import DBSession 6 | from helloworld.tests import setup_db, teardown_db 7 | 8 | __all__ = ['ModelTest'] 9 | 10 | #Create an empty database before we start our tests for this module 11 | def setup(): 12 | """Function called by nose on module load""" 13 | setup_db() 14 | 15 | #Teardown that database 16 | def teardown(): 17 | """Function called by nose after all tests in this module ran""" 18 | teardown_db() 19 | 20 | class ModelTest(object): 21 | """Base unit test case for the models.""" 22 | 23 | klass = None 24 | attrs = {} 25 | 26 | def setup(self): 27 | try: 28 | new_attrs = {} 29 | new_attrs.update(self.attrs) 30 | new_attrs.update(self.do_get_dependencies()) 31 | self.obj = self.klass(**new_attrs) 32 | DBSession.add(self.obj) 33 | DBSession.flush() 34 | return self.obj 35 | except: 36 | DBSession.rollback() 37 | raise 38 | 39 | def tearDown(self): 40 | DBSession.rollback() 41 | 42 | def do_get_dependencies(self): 43 | """Use this method to pull in other objects that need to be created for this object to be build properly""" 44 | return {} 45 | 46 | def test_create_obj(self): 47 | pass 48 | 49 | def test_query_obj(self): 50 | obj = DBSession.query(self.klass).one() 51 | for key, value in self.attrs.iteritems(): 52 | assert_equals(getattr(obj, key), value) 53 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/tests/models/test_auth.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite for the TG app's models""" 3 | from nose.tools import eq_ 4 | 5 | from helloworld import model 6 | from helloworld.tests.models import ModelTest 7 | 8 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/websetup/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Setup the HelloWorld application""" 3 | 4 | import logging 5 | 6 | from helloworld.config.environment import load_environment 7 | 8 | __all__ = ['setup_app'] 9 | 10 | log = logging.getLogger(__name__) 11 | 12 | from schema import setup_schema 13 | from bootstrap import bootstrap 14 | 15 | def setup_app(command, conf, vars): 16 | """Place any commands to setup helloworld here""" 17 | load_environment(conf.global_conf, conf.local_conf) 18 | setup_schema(command, conf, vars) 19 | bootstrap(command, conf, vars) 20 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/websetup/bootstrap.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Setup the HelloWorld application""" 3 | 4 | import logging 5 | from tg import config 6 | from helloworld import model 7 | 8 | import transaction 9 | 10 | 11 | def bootstrap(command, conf, vars): 12 | """Place any commands to setup helloworld here""" 13 | 14 | # 17 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/helloworld/websetup/schema.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Setup the HelloWorld application""" 3 | 4 | import logging 5 | import transaction 6 | from tg import config 7 | 8 | def setup_schema(command, conf, vars): 9 | """Place any commands to setup helloworld here""" 10 | # Load the models 11 | 12 | # 13 | from helloworld import model 14 | # 15 | 16 | 17 | # 18 | print "Creating tables" 19 | model.metadata.create_all(bind=config['pylons.app_globals'].sa_engine) 20 | # 21 | transaction.commit() 22 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/production.ini: -------------------------------------------------------------------------------- 1 | # 2 | # HelloWorld - TurboGears configuration 3 | # 4 | # The %(here)s variable will be replaced with the parent directory of this file 5 | # 6 | [DEFAULT] 7 | # WARGING == If debug is not set to false, you'll get the interactive 8 | # debugger on production, which is a huge security hole. 9 | 10 | debug = false 11 | email_to = you@yourdomain.com 12 | smtp_server = localhost 13 | error_email_from = paste@localhost 14 | 15 | [server:main] 16 | use = egg:Paste#http 17 | host = 127.0.0.1 18 | port = 8080 19 | 20 | [app:main] 21 | use = egg:HelloWorld 22 | full_stack = true 23 | cache_dir = %(here)s/data 24 | beaker.session.key = helloworld 25 | beaker.session.secret = ${app_instance_secret} 26 | app_instance_uuid = ${app_instance_uuid} 27 | 28 | # If you'd like to fine-tune the individual locations of the cache data dirs 29 | # for the Cache data, or the Session saves, un-comment the desired settings 30 | # here: 31 | #beaker.cache.data_dir = %(here)s/data/cache 32 | #beaker.session.data_dir = %(here)s/data/sessions 33 | # Specify the database for SQLAlchemy to use via 34 | # turbogears.database 35 | # %(here) may include a ':' character on Windows environments; this can 36 | # invalidate the URI when specifying a SQLite db via path name 37 | sqlalchemy.url = sqlite:///%(here)s/hello.db 38 | sqlalchemy.echo = False 39 | sqlalchemy.echo_pool = false 40 | sqlalchemy.pool_recycle = 3600 41 | 42 | # WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* 43 | # Debug mode will enable the interactive debugging tool, allowing ANYONE to 44 | # execute malicious code after an exception is raised. 45 | set debug = false 46 | 47 | # Logging configuration 48 | # Add additional loggers, handlers, formatters here 49 | # Uses python's logging config file format 50 | # http://docs.python.org/lib/logging-config-fileformat.html 51 | 52 | [loggers] 53 | keys = root, helloworld, sqlalchemy 54 | 55 | [handlers] 56 | keys = console 57 | 58 | [formatters] 59 | keys = generic 60 | 61 | # If you create additional loggers, add them as a key to [loggers] 62 | [logger_root] 63 | level = WARN 64 | handlers = console 65 | 66 | [logger_helloworld] 67 | level = WARN 68 | handlers = 69 | qualname = helloworld 70 | 71 | [logger_sqlalchemy] 72 | level = WARN 73 | handlers = 74 | qualname = sqlalchemy.engine 75 | # "level = INFO" logs SQL queries. 76 | # "level = DEBUG" logs SQL queries and results. 77 | # "level = WARN" logs neither. (Recommended for production systems.) 78 | 79 | 80 | # If you create additional handlers, add them as a key to [handlers] 81 | [handler_console] 82 | class = StreamHandler 83 | args = (sys.stderr,) 84 | level = NOTSET 85 | formatter = generic 86 | 87 | # If you create additional formatters, add them as a key to [formatters] 88 | [formatter_generic] 89 | format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s 90 | datefmt = %H:%M:%S 91 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/setup.cfg: -------------------------------------------------------------------------------- 1 | [egg_info] 2 | tag_build = dev 3 | tag_svn_revision = true 4 | 5 | [easy_install] 6 | find_links = http://www.pylonshq.com/download/ 7 | 8 | [nosetests] 9 | with-pylons=test.ini 10 | 11 | # Babel configuration 12 | [compile_catalog] 13 | domain = helloworld 14 | directory = helloworld/i18n 15 | statistics = true 16 | 17 | [extract_messages] 18 | add_comments = TRANSLATORS: 19 | output_file = helloworld/i18n/helloworld.pot 20 | width = 80 21 | keywords = l_ 22 | 23 | [init_catalog] 24 | domain = helloworld 25 | input_file = helloworld/i18n/helloworld.pot 26 | output_dir = helloworld/i18n 27 | 28 | [update_catalog] 29 | domain = helloworld 30 | input_file = helloworld/i18n/helloworld.pot 31 | output_dir = helloworld/i18n 32 | previous = true 33 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | try: 3 | from setuptools import setup, find_packages 4 | except ImportError: 5 | from ez_setup import use_setuptools 6 | use_setuptools() 7 | from setuptools import setup, find_packages 8 | 9 | setup( 10 | name='HelloWorld', 11 | version='0.1', 12 | description='', 13 | author='', 14 | author_email='', 15 | #url='', 16 | install_requires=[ 17 | "TurboGears2 == 2.1.2", 18 | "sqlalchemy == 0.7.2", 19 | "zope.sqlalchemy >= 0.4", 20 | "repoze.tm", 21 | "jinja2", 22 | ], 23 | setup_requires=["PasteScript >= 1.7"], 24 | paster_plugins=['PasteScript', 'Pylons', 'TurboGears2', 'tg.devtools'], 25 | packages=find_packages(exclude=['ez_setup']), 26 | include_package_data=True, 27 | test_suite='nose.collector', 28 | tests_require=['WebTest', 'BeautifulSoup'], 29 | package_data={'helloworld': ['i18n/*/LC_MESSAGES/*.mo', 30 | 'templates/*/*', 31 | 'public/*/*']}, 32 | message_extractors={'helloworld': [ 33 | ('**.py', 'python', None), 34 | ('templates/**.mako', 'mako', None), 35 | ('templates/**.html', 'genshi', None), 36 | ('public/**', 'ignore', None)]}, 37 | 38 | entry_points=""" 39 | [paste.app_factory] 40 | main = helloworld.config.middleware:make_app 41 | 42 | [paste.app_install] 43 | main = pylons.util:PylonsInstaller 44 | """, 45 | ) 46 | -------------------------------------------------------------------------------- /turbogears/HelloWorld/test.ini: -------------------------------------------------------------------------------- 1 | # 2 | # HelloWorld - TurboGears 2 testing environment configuration 3 | # 4 | # The %(here)s variable will be replaced with the parent directory of this file 5 | # 6 | [DEFAULT] 7 | debug = true 8 | # Uncomment and replace with the address which should receive any error reports 9 | # email_to = you@yourdomain.com 10 | smtp_server = localhost 11 | error_email_from = paste@localhost 12 | 13 | [server:main] 14 | use = egg:Paste#http 15 | host = 0.0.0.0 16 | port = 5000 17 | 18 | [app:main] 19 | use = config:development.ini 20 | 21 | [app:main_without_authn] 22 | use = main 23 | skip_authentication = True 24 | 25 | # Add additional test specific configuration options as necessary. 26 | -------------------------------------------------------------------------------- /turbogears/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | TurboGears test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using TurboGears **v2.1.2** and will likely perform 13 | differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /turbogears/wsgi.wsgi: -------------------------------------------------------------------------------- 1 | import os, sys 2 | 3 | # override stdout 4 | sys.stdout = sys.stderr 5 | 6 | # import site directives for virtualenv 7 | import site 8 | 9 | ALLDIRS = ['/var/www/venv_tg21/lib/python2.6/site-packages'] 10 | 11 | # Remember original sys.path. 12 | prev_sys_path = list(sys.path) 13 | 14 | # Add each new site-packages directory. 15 | for directory in ALLDIRS: 16 | site.addsitedir(directory) 17 | 18 | # Reorder sys.path so new directories at the front. 19 | new_sys_path = [] 20 | for item in list(sys.path): 21 | if item not in prev_sys_path: 22 | new_sys_path.append(item) 23 | sys.path.remove(item) 24 | sys.path[:0] = new_sys_path 25 | 26 | # append project root directory path 27 | path = '/var/www/tg_21/HelloWorld' 28 | if path not in sys.path: 29 | sys.path.append(path) 30 | 31 | os.environ['PYTHON_EGG_CACHE'] = '/var/www/.python-eggs' 32 | 33 | # loadapp 34 | from paste.deploy import loadapp 35 | application = loadapp('config:/var/www/tg_21/HelloWorld/production.ini') 36 | -------------------------------------------------------------------------------- /webgo/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Web.go test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using Web.go **commit 111463f** for **Go r59** and 13 | will likely perform differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /webgo/hello.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/webgo/hello.db -------------------------------------------------------------------------------- /webgo/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | "path" 6 | // "github.com/kuroneko/sqlite3" /* git://github.com/kuroneko/gosqlite3.git */ 7 | "web" /* git://github.com/hoisie/web.go.git */ 8 | "mustache" /* git://github.com/hoisie/mustache.go */ 9 | ) 10 | 11 | func hello() string { return "Hello world!" } 12 | func hellos() string { 13 | filename := path.Join(path.Join(os.Getenv("PWD"), "tmpl"), "hellos.mustache") 14 | output := mustache.RenderFile(filename); 15 | return output 16 | } 17 | //func hellodb() string { 18 | // 19 | //} 20 | 21 | func main() { 22 | web.Get("/", hello) 23 | web.Get("/hellos", hellos) 24 | // web.Get("/hellodb", hellodb) 25 | web.Run("localhost:80") 26 | } 27 | -------------------------------------------------------------------------------- /webgo/tmpl/db.mustache: -------------------------------------------------------------------------------- 1 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
1{{1}}
2{{2}}
3{{3}}
4{{4}}
5{{5}}
10 | -------------------------------------------------------------------------------- /webgo/tmpl/hellodb.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World 5 | 6 | 7 | 8 | {{> db}} 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /webgo/tmpl/hellos.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World 5 | 6 | 7 | 8 | {{> lipsum}} 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /webgo/tmpl/lipsum.mustache: -------------------------------------------------------------------------------- 1 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

2 | -------------------------------------------------------------------------------- /yii/README.rst: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Yii test code for The Great Web Framework Shootout 3 | ================================================================================ 4 | 5 | | Copyright: (c) 2012 Seth Davis 6 | | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 7 | 8 | 9 | Synopsis 10 | ================================================================================ 11 | 12 | This code was last tested using Yii **v1.1.8** and will likely perform 13 | differently when using a different version. 14 | 15 | Please see `The Great Web Framework Shootout`_ for more information. 16 | 17 | .. _The Great Web Framework Shootout: 18 | http://blog.curiasolutions.com/the-great-web-framework-shootout/ 19 | -------------------------------------------------------------------------------- /yii/protected/config/main.php: -------------------------------------------------------------------------------- 1 | dirname(__FILE__).DIRECTORY_SEPARATOR.'..', 10 | 'name'=>'My Web Application', 11 | 12 | // preloading 'log' component 13 | 'preload'=>array('log'), 14 | 15 | // autoloading model and component classes 16 | 'import'=>array( 17 | 'application.models.*', 18 | 'application.components.*', 19 | ), 20 | 21 | 'modules'=>array( 22 | // uncomment the following to enable the Gii tool 23 | /* 24 | 'gii'=>array( 25 | 'class'=>'system.gii.GiiModule', 26 | 'password'=>'Enter Your Password Here', 27 | // If removed, Gii defaults to localhost only. Edit carefully to taste. 28 | 'ipFilters'=>array('127.0.0.1','::1'), 29 | ), 30 | */ 31 | ), 32 | 33 | // application components 34 | 'components'=>array( 35 | 'user'=>array( 36 | // enable cookie-based authentication 37 | 'allowAutoLogin'=>true, 38 | ), 39 | // uncomment the following to enable URLs in path-format 40 | /* 41 | 'urlManager'=>array( 42 | 'urlFormat'=>'path', 43 | 'rules'=>array( 44 | '/'=>'/view', 45 | '//'=>'/', 46 | '/'=>'/', 47 | ), 48 | ), 49 | */ 50 | 'db'=>array( 51 | 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/hello.db', 52 | ), 53 | // uncomment the following to use a MySQL database 54 | /* 55 | 'db'=>array( 56 | 'connectionString' => 'mysql:host=localhost;dbname=testdrive', 57 | 'emulatePrepare' => true, 58 | 'username' => 'root', 59 | 'password' => '', 60 | 'charset' => 'utf8', 61 | ), 62 | */ 63 | 'errorHandler'=>array( 64 | // use 'site/error' action to display errors 65 | 'errorAction'=>'site/error', 66 | ), 67 | 'log'=>array( 68 | 'class'=>'CLogRouter', 69 | 'routes'=>array( 70 | array( 71 | 'class'=>'CFileLogRoute', 72 | 'levels'=>'error, warning', 73 | ), 74 | // uncomment the following to show log messages on web pages 75 | /* 76 | array( 77 | 'class'=>'CWebLogRoute', 78 | ), 79 | */ 80 | ), 81 | ), 82 | ), 83 | 84 | // application-level parameters that can be accessed 85 | // using Yii::app()->params['paramName'] 86 | 'params'=>array( 87 | // this is used in contact page 88 | 'adminEmail'=>'webmaster@example.com', 89 | ), 90 | ); 91 | -------------------------------------------------------------------------------- /yii/protected/controllers/HelloController.php: -------------------------------------------------------------------------------- 1 | findAll(); 8 | $this->render('index', array('data' => $data)); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /yii/protected/controllers/HellosController.php: -------------------------------------------------------------------------------- 1 | render('index'); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /yii/protected/data/hello.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/yii/protected/data/hello.db -------------------------------------------------------------------------------- /yii/protected/data/schema.mysql.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE tbl_user ( 2 | id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, 3 | username VARCHAR(128) NOT NULL, 4 | password VARCHAR(128) NOT NULL, 5 | email VARCHAR(128) NOT NULL 6 | ); 7 | 8 | INSERT INTO tbl_user (username, password, email) VALUES ('test1', 'pass1', 'test1@example.com'); 9 | INSERT INTO tbl_user (username, password, email) VALUES ('test2', 'pass2', 'test2@example.com'); 10 | INSERT INTO tbl_user (username, password, email) VALUES ('test3', 'pass3', 'test3@example.com'); 11 | INSERT INTO tbl_user (username, password, email) VALUES ('test4', 'pass4', 'test4@example.com'); 12 | INSERT INTO tbl_user (username, password, email) VALUES ('test5', 'pass5', 'test5@example.com'); 13 | INSERT INTO tbl_user (username, password, email) VALUES ('test6', 'pass6', 'test6@example.com'); 14 | INSERT INTO tbl_user (username, password, email) VALUES ('test7', 'pass7', 'test7@example.com'); 15 | INSERT INTO tbl_user (username, password, email) VALUES ('test8', 'pass8', 'test8@example.com'); 16 | INSERT INTO tbl_user (username, password, email) VALUES ('test9', 'pass9', 'test9@example.com'); 17 | INSERT INTO tbl_user (username, password, email) VALUES ('test10', 'pass10', 'test10@example.com'); 18 | INSERT INTO tbl_user (username, password, email) VALUES ('test11', 'pass11', 'test11@example.com'); 19 | INSERT INTO tbl_user (username, password, email) VALUES ('test12', 'pass12', 'test12@example.com'); 20 | INSERT INTO tbl_user (username, password, email) VALUES ('test13', 'pass13', 'test13@example.com'); 21 | INSERT INTO tbl_user (username, password, email) VALUES ('test14', 'pass14', 'test14@example.com'); 22 | INSERT INTO tbl_user (username, password, email) VALUES ('test15', 'pass15', 'test15@example.com'); 23 | INSERT INTO tbl_user (username, password, email) VALUES ('test16', 'pass16', 'test16@example.com'); 24 | INSERT INTO tbl_user (username, password, email) VALUES ('test17', 'pass17', 'test17@example.com'); 25 | INSERT INTO tbl_user (username, password, email) VALUES ('test18', 'pass18', 'test18@example.com'); 26 | INSERT INTO tbl_user (username, password, email) VALUES ('test19', 'pass19', 'test19@example.com'); 27 | INSERT INTO tbl_user (username, password, email) VALUES ('test20', 'pass20', 'test20@example.com'); 28 | INSERT INTO tbl_user (username, password, email) VALUES ('test21', 'pass21', 'test21@example.com'); 29 | -------------------------------------------------------------------------------- /yii/protected/data/schema.sqlite.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE tbl_user ( 2 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 3 | username VARCHAR(128) NOT NULL, 4 | password VARCHAR(128) NOT NULL, 5 | email VARCHAR(128) NOT NULL 6 | ); 7 | 8 | INSERT INTO tbl_user (username, password, email) VALUES ('test1', 'pass1', 'test1@example.com'); 9 | INSERT INTO tbl_user (username, password, email) VALUES ('test2', 'pass2', 'test2@example.com'); 10 | INSERT INTO tbl_user (username, password, email) VALUES ('test3', 'pass3', 'test3@example.com'); 11 | INSERT INTO tbl_user (username, password, email) VALUES ('test4', 'pass4', 'test4@example.com'); 12 | INSERT INTO tbl_user (username, password, email) VALUES ('test5', 'pass5', 'test5@example.com'); 13 | INSERT INTO tbl_user (username, password, email) VALUES ('test6', 'pass6', 'test6@example.com'); 14 | INSERT INTO tbl_user (username, password, email) VALUES ('test7', 'pass7', 'test7@example.com'); 15 | INSERT INTO tbl_user (username, password, email) VALUES ('test8', 'pass8', 'test8@example.com'); 16 | INSERT INTO tbl_user (username, password, email) VALUES ('test9', 'pass9', 'test9@example.com'); 17 | INSERT INTO tbl_user (username, password, email) VALUES ('test10', 'pass10', 'test10@example.com'); 18 | INSERT INTO tbl_user (username, password, email) VALUES ('test11', 'pass11', 'test11@example.com'); 19 | INSERT INTO tbl_user (username, password, email) VALUES ('test12', 'pass12', 'test12@example.com'); 20 | INSERT INTO tbl_user (username, password, email) VALUES ('test13', 'pass13', 'test13@example.com'); 21 | INSERT INTO tbl_user (username, password, email) VALUES ('test14', 'pass14', 'test14@example.com'); 22 | INSERT INTO tbl_user (username, password, email) VALUES ('test15', 'pass15', 'test15@example.com'); 23 | INSERT INTO tbl_user (username, password, email) VALUES ('test16', 'pass16', 'test16@example.com'); 24 | INSERT INTO tbl_user (username, password, email) VALUES ('test17', 'pass17', 'test17@example.com'); 25 | INSERT INTO tbl_user (username, password, email) VALUES ('test18', 'pass18', 'test18@example.com'); 26 | INSERT INTO tbl_user (username, password, email) VALUES ('test19', 'pass19', 'test19@example.com'); 27 | INSERT INTO tbl_user (username, password, email) VALUES ('test20', 'pass20', 'test20@example.com'); 28 | INSERT INTO tbl_user (username, password, email) VALUES ('test21', 'pass21', 'test21@example.com'); 29 | -------------------------------------------------------------------------------- /yii/protected/data/testdrive.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedifferently/the-great-web-framework-shootout/0425e9e446e91fcc587faeaa824ffdde2134ffa6/yii/protected/data/testdrive.db -------------------------------------------------------------------------------- /yii/protected/models/Hello.php: -------------------------------------------------------------------------------- 1 | 'search'), 41 | ); 42 | } 43 | 44 | /** 45 | * @return array relational rules. 46 | */ 47 | public function relations() 48 | { 49 | // NOTE: you may need to adjust the relation name and the related 50 | // class name for the relations automatically generated below. 51 | return array( 52 | ); 53 | } 54 | 55 | /** 56 | * @return array customized attribute labels (name=>label) 57 | */ 58 | public function attributeLabels() 59 | { 60 | return array( 61 | 'id' => 'ID', 62 | 'data' => 'Data', 63 | ); 64 | } 65 | 66 | /** 67 | * Retrieves a list of models based on the current search/filter conditions. 68 | * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. 69 | */ 70 | public function search() 71 | { 72 | // Warning: Please modify the following code to remove attributes that 73 | // should not be searched. 74 | 75 | $criteria=new CDbCriteria; 76 | 77 | $criteria->compare('id',$this->id); 78 | $criteria->compare('data',$this->data,true); 79 | 80 | return new CActiveDataProvider($this, array( 81 | 'criteria'=>$criteria, 82 | )); 83 | } 84 | } -------------------------------------------------------------------------------- /yii/protected/views/hellodb/index.php: -------------------------------------------------------------------------------- 1 | beginContent('//layouts/main'); ?> 2 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

3 | 4 | 5 | 6 | 7 | 8 |
id; ?>data;?>
9 | endContent(); ?> 10 | -------------------------------------------------------------------------------- /yii/protected/views/hellos/index.php: -------------------------------------------------------------------------------- 1 | beginContent('//layouts/main'); ?> 2 |

Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum non.

3 | endContent(); ?> 4 | -------------------------------------------------------------------------------- /yii/protected/views/layouts/main.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | --------------------------------------------------------------------------------