Permalink
Browse files

fix some mistakes in templates

  • Loading branch information...
1 parent 81a4230 commit 88e3139c62ab0a1895de311634db7240248dc762 @domenkozar committed Jan 1, 2013
View
@@ -27,6 +27,8 @@ pyramid
python_package
Replaces paster's `basic_template` with more modern ideas :-)
+ - Python 3 ready
+
TODO
====
@@ -20,7 +20,7 @@ def main(global_config, **settings):
config.include('.site')
config.scan()
- config.add_translation_dirs('${project}:locale/')
+ config.add_translation_dirs('{{{package.dottedname}}}:locale/')
# setup cookie session
cookie_session_secret = ''.join('%02x' % ord(x) for x in os.urandom(16))
@@ -1,59 +0,0 @@
-from __future__ import with_statement
-from logging.config import fileConfig
-
-from alembic import context
-from sqlalchemy import engine_from_config, pool
-
-# TODO: find a better way to do this
-from {{{package.dottedname}}}.site.models import Base
-
-metadata = Base.metadata
-
-
-def run_migrations_offline():
- """Run migrations in 'offline' mode.
-
- This configures the context with just a URL
- and not an Engine, though an Engine is acceptable
- here as well. By skipping the Engine creation
- we don't even need a DBAPI to be available.
-
- Calls to context.execute() here emit the given string to the
- script output.
-
- """
- url = context.config.get_main_option("sqlalchemy.url")
- context.configure(url=url)
-
- with context.begin_transaction():
- context.run_migrations()
-
-def run_migrations_online(metadata):
- """Run migrations in 'online' mode.
-
- In this scenario we need to create an Engine
- and associate a connection with the context.
-
- """
- engine = engine_from_config(
- context.config.get_section(context.config.config_ini_section),
- prefix='sqlalchemy.',
- poolclass=pool.NullPool)
-
- connection = engine.connect()
- context.configure(
- connection=connection,
- target_metadata=metadata
- )
-
- try:
- with context.begin_transaction():
- context.run_migrations()
- finally:
- connection.close()
-
-
-if context.is_offline_mode():
- run_migrations_offline()
-else:
- run_migrations_online(metadata)
@@ -5,8 +5,8 @@
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta name="keywords" content="python web application" />
<meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="{{request.static_url('${project}:static/favicon.ico')}}" />
- <link rel="stylesheet" href="{{request.static_url('${project}:static/style.css')}}" type="text/css" media="screen" charset="utf-8" />
+ <link rel="shortcut icon" href="{{request.static_url('{{{package.dottedname}}}:static/favicon.ico')}}" />
+ <link rel="stylesheet" href="{{request.static_url('{{{package.dottedname}}}:static/style.css')}}" type="text/css" media="screen" charset="utf-8" />
</head>
<body>
Hello!
@@ -32,3 +32,4 @@ def setUp(self):
from . import main
app = main({})
self.testapp = TestApp(app)
+ # TODO: SQL functional testing
@@ -6,7 +6,7 @@ package.name.required = True
package.description.question = Description of the package (visible on PyPI and similar)
package.version.question = Version?
package.version.default = 0.1
-package.respository.question = Repository URL for the package
+package.repository.question = Repository URL for the package
package.url.question = URL for more information about the package
author.name.question = Author name?
author.email.question = Author email address?
@@ -5,7 +5,7 @@ $projectname
:URL: {{{package.url}}}
:Docs: {{{docs.url}}}
:Source: {{{package.repository}}}
-:Licence: {{{license}}}
+:Licence: BSD
:Framework: Pyramid
:version: |release|
:Generated: |today|
@@ -1,19 +1,19 @@
server {
listen 80;
- server_name ${project}.com www.${project}.com;
- access_log /var/log/nginx/${project}.access.log;
+ server_namep project.com www.project.com;
+ access_log /var/log/nginx/project.access.log;
# Redirect from www to non-www
- if (\$host ~* "^www\.(.*)") {
- set \$new_host \$1;
- rewrite ^/(.*)\$ http://\$new_host/\$1;
+ if ($host ~* "^www\.(.*)") {
+ set $new_host $1;
+ rewrite ^/(.*)$ http://$new_host/$1;
}
location / {
- proxy_set_header Host \$host;
- proxy_set_header X-Real-IP \$remote_addr;
- proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto \$scheme;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 50m;
client_body_buffer_size 128k;
@@ -22,7 +22,7 @@ server {
proxy_read_timeout 90s;
proxy_buffering off;
proxy_temp_file_write_size 64k;
- proxy_pass http://127.0.0.1:\${ports:gunicorn};
+ proxy_pass http://127.0.0.1:${ports:gunicorn};
proxy_redirect off;
}
}
@@ -1,4 +1,4 @@
-[app:{{package.dottedname}}]
+[app:{{{package.dottedname}}}]
use = egg:{{{package.dottedname}}}
pyramid.reload_templates = false
@@ -24,7 +24,7 @@ setup(
keywords='web wsgi pylons pyramid',
author='{{{author.name}}}',
author_email='{{{author.email}}}',
- url='{{{url}}}',
+ url='{{{package.url}}}',
license='BSD',
packages=find_packages(),
install_requires=[
@@ -11,5 +11,5 @@ package.url.question = URL for more information about the package
author.name.question = Author name?
author.email.question = Author email address?
python3.question = Do you want to support Python 3?
-python3.validator = mrbob.validators:boolean
+python3.post_ask_question = mrbob.hooks:to_boolean
python3.required = True
@@ -2,13 +2,13 @@ language: python
python:
- 2.6
- 2.7
- - pypy
{{% if python3 %}}
- - 3.1
- 3.2
+ - 3.3
{{% endif %}}
+ - pypy
install:
- python setup.py develop
- - easy_install ${package.name}[test]
+ - easy_install {{{package.name}}}[test]
script:
- ./run_tests.sh
@@ -1,4 +1,4 @@
-{{{description}}}
+{{{package.description}}}
INSTALL
=======
@@ -22,7 +22,7 @@ setup(
],
author='{{{author.name}}}',
author_email='{{{author.email}}}',
- url='{{{url}}}',
+ url='{{{package.url}}}',
license='BSD',
packages=find_packages(),
install_requires=[

0 comments on commit 88e3139

Please sign in to comment.