1 files deleted
2 files added
8 files modified
New file |
| | |
| | | [run] |
| | | source = tutorial |
| | | omit = tutorial/test* |
| | |
| | | 0.0 |
| | | --- |
| | | |
| | | - Initial version |
| | | - Initial version. |
| | |
| | | tutorial README |
| | | ================== |
| | | myproj |
| | | =============================== |
| | | |
| | | Getting Started |
| | | --------------- |
| | | |
| | | - cd <directory containing this file> |
| | | - Change directory into your newly created project. |
| | | |
| | | - $VENV/bin/pip install -e . |
| | | cd myproj |
| | | |
| | | - $VENV/bin/pserve development.ini |
| | | - Create a Python virtual environment. |
| | | |
| | | python3 -m venv env |
| | | |
| | | - Upgrade packaging tools. |
| | | |
| | | env/bin/pip install --upgrade pip setuptools wheel |
| | | |
| | | - Install the project in editable mode with its testing requirements. |
| | | |
| | | env/bin/pip install -e ".[testing]" |
| | | |
| | | - Run your project's tests. |
| | | |
| | | env/bin/pytest |
| | | |
| | | - Run your project. |
| | | |
| | | env/bin/pserve development.ini |
| | |
| | | ### |
| | | # app configuration |
| | | # http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/environment.html |
| | | # http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html |
| | | ### |
| | | |
| | | [app:main] |
| | |
| | | pyramid.default_locale_name = en |
| | | pyramid.includes = |
| | | pyramid_debugtoolbar |
| | | pyramid_zodbconn |
| | | pyramid_tm |
| | | |
| | | tm.attempts = 3 |
| | | zodbconn.uri = file://%(here)s/Data.fs?connection_cache_size=20000 |
| | | |
| | | # By default, the toolbar only appears for clients from IP addresses |
| | |
| | | |
| | | ### |
| | | # logging configuration |
| | | # http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/logging.html |
| | | # http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html |
| | | ### |
| | | |
| | | [loggers] |
| | |
| | | ### |
| | | # app configuration |
| | | # http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/environment.html |
| | | # http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html |
| | | ### |
| | | |
| | | [app:main] |
| | |
| | | pyramid.debug_notfound = false |
| | | pyramid.debug_routematch = false |
| | | pyramid.default_locale_name = en |
| | | pyramid.includes = |
| | | pyramid_tm |
| | | pyramid_zodbconn |
| | | |
| | | tm.attempts = 3 |
| | | zodbconn.uri = file://%(here)s/Data.fs?connection_cache_size=20000 |
| | | |
| | | ### |
| | |
| | | |
| | | ### |
| | | # logging configuration |
| | | # http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/logging.html |
| | | # http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html |
| | | ### |
| | | |
| | | [loggers] |
New file |
| | |
| | | [pytest] |
| | | testpaths = tutorial |
| | | python_files = *.py |
| | |
| | | 'ZODB3', |
| | | 'waitress', |
| | | 'docutils', |
| | | ] |
| | | ] |
| | | |
| | | tests_require = [ |
| | | 'WebTest >= 1.3.1', # py3 compat |
| | | 'pytest', # includes virtualenv |
| | | 'pytest', |
| | | 'pytest-cov', |
| | | ] |
| | | ] |
| | | |
| | | setup(name='tutorial', |
| | | version='0.0', |
| | | description='tutorial', |
| | | long_description=README + '\n\n' + CHANGES, |
| | | classifiers=[ |
| | | "Programming Language :: Python", |
| | | "Framework :: Pyramid", |
| | | "Topic :: Internet :: WWW/HTTP", |
| | | "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", |
| | | ], |
| | | author='', |
| | | author_email='', |
| | | url='', |
| | | keywords='web pylons pyramid', |
| | | packages=find_packages(), |
| | | include_package_data=True, |
| | | zip_safe=False, |
| | | extras_require={ |
| | | 'testing': tests_require, |
| | | }, |
| | | install_requires=requires, |
| | | entry_points="""\ |
| | | [paste.app_factory] |
| | | main = tutorial:main |
| | | """, |
| | | ) |
| | | setup( |
| | | name='tutorial', |
| | | version='0.0', |
| | | description='myproj', |
| | | long_description=README + '\n\n' + CHANGES, |
| | | classifiers=[ |
| | | 'Programming Language :: Python', |
| | | 'Framework :: Pyramid', |
| | | 'Topic :: Internet :: WWW/HTTP', |
| | | 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', |
| | | ], |
| | | author='', |
| | | author_email='', |
| | | url='', |
| | | keywords='web pyramid pylons', |
| | | packages=find_packages(), |
| | | include_package_data=True, |
| | | zip_safe=False, |
| | | extras_require={ |
| | | 'testing': tests_require, |
| | | }, |
| | | install_requires=requires, |
| | | entry_points={ |
| | | 'paste.app_factory': [ |
| | | 'main = tutorial:main', |
| | | ], |
| | | }, |
| | | ) |
| | |
| | | """ |
| | | config = Configurator(root_factory=root_factory, settings=settings) |
| | | config.include('pyramid_chameleon') |
| | | config.include('pyramid_tm') |
| | | config.include('pyramid_zodbconn') |
| | | config.add_static_view('static', 'static', cache_max_age=3600) |
| | | config.scan() |
| | | return config.make_wsgi_app() |
| | |
| | | from .views import my_view |
| | | request = testing.DummyRequest() |
| | | info = my_view(request) |
| | | self.assertEqual(info['project'], 'tutorial') |
| | | self.assertEqual(info['project'], 'myproj') |
| | |
| | | return HTTPFound(location = request.resource_url(context)) |
| | | |
| | | return dict(page=context, |
| | | save_url=request.resource_url(context, 'edit_page')) |
| | | save_url=request.resource_url(context, 'edit_page')) |