New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Alembic support from alchemy cookiecutter #3307

Merged
merged 26 commits into from Aug 5, 2018

Conversation

Projects
None yet
2 participants
@stevepiercy
Member

stevepiercy commented Jun 23, 2018

WIP. Should be backported to 1.9-branch only upon completion.

See #1597 and Pylons/pyramid-cookiecutter-alchemy#7

@stevepiercy

This comment has been minimized.

Show comment
Hide comment
@stevepiercy

stevepiercy Jun 28, 2018

Member

@mmerickel I took a stab at merging the cookiecutter's default script with the tutorial's script from the models step. When I run it, I get an import error. See stack trace below.

I'm not sure whether the script is correct and I should wait until I fix the views in the next step to get it to run, or the script is wrong. Will pyramid.bootstrap only work when the app is in a runnable state?

$ env/bin/initialize_tutorial_db development.ini
Traceback (most recent call last):
  File "env/bin/initialize_tutorial_db", line 11, in <module>
    load_entry_point('tutorial', 'console_scripts', 'initialize_tutorial_db')()
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/tutorial/scripts/initialize_db.py", line 40, in main
    env = bootstrap(config_uri)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/pyramid/paster.py", line 107, in bootstrap
    app = get_app(config_uri, options=options)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/pyramid/paster.py", line 28, in get_app
    return loader.get_wsgi_app(name, options)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/plaster_pastedeploy/__init__.py", line 131, in get_wsgi_app
    global_conf=defaults)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/tutorial/__init__.py", line 11, in main
    config.scan()
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/pyramid/config/__init__.py", line 1043, in scan
    ignore=ignore)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/venusian/__init__.py", line 230, in scan
    __import__(modname)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/tutorial/views/default.py", line 6, in <module>
    from ..models import MyModel
ImportError: cannot import name 'MyModel'
Member

stevepiercy commented Jun 28, 2018

@mmerickel I took a stab at merging the cookiecutter's default script with the tutorial's script from the models step. When I run it, I get an import error. See stack trace below.

I'm not sure whether the script is correct and I should wait until I fix the views in the next step to get it to run, or the script is wrong. Will pyramid.bootstrap only work when the app is in a runnable state?

$ env/bin/initialize_tutorial_db development.ini
Traceback (most recent call last):
  File "env/bin/initialize_tutorial_db", line 11, in <module>
    load_entry_point('tutorial', 'console_scripts', 'initialize_tutorial_db')()
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/tutorial/scripts/initialize_db.py", line 40, in main
    env = bootstrap(config_uri)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/pyramid/paster.py", line 107, in bootstrap
    app = get_app(config_uri, options=options)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/pyramid/paster.py", line 28, in get_app
    return loader.get_wsgi_app(name, options)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/plaster_pastedeploy/__init__.py", line 131, in get_wsgi_app
    global_conf=defaults)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/tutorial/__init__.py", line 11, in main
    config.scan()
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/pyramid/config/__init__.py", line 1043, in scan
    ignore=ignore)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/env/lib/python3.5/site-packages/venusian/__init__.py", line 230, in scan
    __import__(modname)
  File "/Users/stevepiercy/projects/hack-on-pyramid/tutorial/tutorial/views/default.py", line 6, in <module>
    from ..models import MyModel
ImportError: cannot import name 'MyModel'

stevepiercy added some commits Jun 28, 2018

Gardening of definingmodels.rst
- Synch up emphasize-lines to new script changes
- Update output examples
@stevepiercy

This comment has been minimized.

Show comment
Hide comment
@stevepiercy

stevepiercy Jun 30, 2018

Member

@mmerickel ready for final review.

Member

stevepiercy commented Jun 30, 2018

@mmerickel ready for final review.

@mmerickel mmerickel added this to the 1.10 milestone Jul 30, 2018

@mmerickel

This looks great @stevepiercy.

@mmerickel mmerickel removed the do-not-merge label Aug 5, 2018

@mmerickel mmerickel merged commit 76c066c into master Aug 5, 2018

4 checks passed

continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@mmerickel mmerickel deleted the alembic-cookiecutter-alchemy branch Aug 5, 2018

mmerickel added a commit that referenced this pull request Aug 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment