Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyTSPrf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
pyTSPrf
Commits
b5a9cfd8ef4b
Commit
b5a9cfd8ef4b
authored
9 years ago
by
Florent Aide
Browse files
Options
Downloads
Patches
Plain Diff
moved cli outside __init__.py
parent
9c742aa21ac1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pytsprf/main.py
+30
-0
30 additions, 0 deletions
pytsprf/main.py
with
30 additions
and
0 deletions
pytsprf/main.py
0 → 100644
+
30
−
0
View file @
b5a9cfd8
from
pyramid.config
import
Configurator
from
sqlalchemy
import
engine_from_config
from
sqlalchemy.orm
import
scoped_session
,
sessionmaker
# Import from this project
from
pytsprf.models
import
Base
,
User
def
cli
(
global_config
,
**
settings
):
"""
This function returns a Pyramid WSGI application.
"""
DBSession
=
scoped_session
(
sessionmaker
())
engine
=
engine_from_config
(
settings
,
'
sqlalchemy.
'
)
DBSession
.
configure
(
bind
=
engine
)
Base
.
metadata
.
bind
=
engine
# Fixme, find something more elegant
try
:
DBSession
.
query
(
User
).
all
()
except
Exception
:
print
(
"
Creating database
"
)
Base
.
metadata
.
create_all
(
engine
)
config
=
Configurator
(
settings
=
settings
)
config
.
include
(
'
pyramid_chameleon
'
)
config
.
include
(
"
cornice
"
)
config
.
add_route
(
'
credentials
'
,
'
/credentials
'
)
config
.
add_route
(
'
access
'
,
'
/
'
)
config
.
scan
()
return
config
.
make_wsgi_app
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment