4
from werkzeug.serving import run_simple
8
"""Helper function that creates a plnt app."""
11
database_uri = os.environ.get("PLNT_DATABASE_URI")
12
app = Plnt(database_uri or "sqlite:////tmp/plnt.db")
24
"""Initialize the database"""
25
from plnt.database import Blog, session
27
make_app().init_database()
33
"https://lucumr.pocoo.org/",
34
"https://lucumr.pocoo.org/feed.atom",
38
"https://pyside.blogspot.com/",
39
"https://pyside.blogspot.com/feeds/posts/default",
43
"https://blog.ianbicking.org/",
44
"https://blog.ianbicking.org/feed/",
49
"https://feeds.feedburner.com/amixdk",
53
"https://www.cmlenz.net/blog/",
54
"https://www.cmlenz.net/blog/atom.xml",
58
"https://effbot.org/",
59
"https://effbot.org/rss.xml",
67
click.echo("Initialized database, now run manage-plnt.py sync to get the posts")
71
@click.option("-h", "--hostname", type=str, default="localhost", help="localhost")
72
@click.option("-p", "--port", type=int, default=5000, help="5000")
73
@click.option("--no-reloader", is_flag=True, default=False)
74
@click.option("--debugger", is_flag=True)
75
@click.option("--no-evalex", is_flag=True, default=False)
76
@click.option("--threaded", is_flag=True)
77
@click.option("--processes", type=int, default=1, help="1")
78
def runserver(hostname, port, no_reloader, debugger, no_evalex, threaded, processes):
79
"""Start a new development server."""
81
reloader = not no_reloader
82
evalex = not no_evalex
87
use_reloader=reloader,
88
use_debugger=debugger,
96
@click.option("--no-ipython", is_flag=True, default=False)
98
"""Start a new interactive python session."""
99
banner = "Interactive Werkzeug Shell"
100
namespace = {"app": make_app()}
104
from IPython.frontend.terminal.embed import InteractiveShellEmbed
106
sh = InteractiveShellEmbed.instance(banner1=banner)
108
from IPython.Shell import IPShellEmbed
110
sh = IPShellEmbed(banner=banner)
114
sh(local_ns=namespace)
116
from code import interact
118
interact(banner, local=namespace)
123
"""Sync the blogs in the planet. Call this from a cronjob."""
124
from plnt.sync import sync
126
make_app().bind_to_context()
130
if __name__ == "__main__":