Example #1
0
    def setUp(self):
        app = Flask(__name__)
        app.debug = True
        app.config["MAKO_DIR"] = MAKO_DIR
        mako = MakoTemplates(app)
        self.app = app
        self.mako = mako
        cur_dir = os.path.dirname(os.path.realpath(__file__))
        self.content_path = join(cur_dir, "content")
        self.output_path = join(cur_dir, "output")
        self.output_tags_path = join(self.output_path, "tags")

        @app.route("/regen")
        def regen():
            client = DummyDropboxClient()
            DropboxSync(client, self.content_path, self.output_path, self.output_tags_path).gen_pages()
            return "OK"
Example #2
0
    MAKO_DIR,
    DROPBOX_REQUEST_TOKEN_KEY,
    ENTRY_LINK_PATTERN,
    IMAGE_LINK_PATTERN,
    TAG_LINK_PATTERN,
    PUBLIC_DIR,
    LOCAL_ENTRIES_DIR,
    LOCAL_IMAGE_DIR,
    LOCAL_TAGS_DIR,
    DOMAIN,
    DOMAIN2,
    PAGE_LINK_PATTERN,
)

app = Flask(__name__)
app.config["MAKO_DIR"] = MAKO_DIR
mako = MakoTemplates(app)
app.secret_key = APP_SECRET_KEY
app.debug = True
dropbox = Dropbox()


@app.route("/sync")
def sync():
    if not dropbox.is_authenticated:
        return redirect("/login")

    client = dropbox.client
    if client:
        sync = DropboxSync(client)
        sync.sync_folder()