-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
33 lines (24 loc) · 958 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.session import SignedCookieSessionFactory
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from routes import init_routes
from includes import init_includes
from scans import init_scans
PORT = 6543
engine = create_engine('mysql://cms:123@localhost/cms', echo=True)
Session = sessionmaker(bind=engine, expire_on_commit=False)
Base = declarative_base()
if __name__ == '__main__':
app_session = SignedCookieSessionFactory('123321')
with Configurator() as config:
config.set_session_factory(app_session)
init_routes(config)
init_includes(config)
init_scans(config)
app = config.make_wsgi_app()
print('web server running on port %d' % PORT)
server = make_server('0.0.0.0', PORT, app)
server.serve_forever()