This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# This code finds all the paths leading from a given | |
# point, [the SOURCE] to another point [the DESTINATION] | |
# | |
# The data is mapped in such a way that every point maps | |
# to every point that can "directly" be reached from it. | |
# | |
# Then there is a recursive traversal over each point |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Path:/sancta_crux_app/__init__.py | |
# Module that initialises and runs the app | |
from flask import Flask, render_template | |
from flask.ext.bootstrap import Bootstrap | |
from flask.ext.moment import Moment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Traceback | |
Traceback (most recent call last): | |
File "/home/acetakwas/dev/my_virtualenvs/flask_venv/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__ | |
return self.wsgi_app(environ, start_response) | |
File "/home/acetakwas/dev/my_virtualenvs/flask_venv/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app | |
response = self.make_response(self.handle_exception(e)) | |
File "/home/acetakwas/dev/my_virtualenvs/flask_venv/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception | |
reraise(exc_type, exc_value, tb) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Traceback prints this: | |
APP CREATED AS DEV | |
APP CREATED AS TEST | |
APP CREATED AS PROD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProfileForm(Form): | |
img_fld = FileField('Upload a Profile Photo', \ | |
validators=[FileAllowed(config['IMG_ALLOWED_EXTENSIONS'], 'Images only!')]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
List of actions: | |
do_help | |
do_about | |
""" | |
# standard library imports | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################### | |
# FILE: commands.py | |
################### | |
cmds = { | |
'help' : Command(cmd='help', callback=actions.do_help, | |
help_text= \ | |
""" | |
Usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_app(config_key): | |
""" | |
A factory function to create a Flask application instance and do | |
some initializations. | |
""" | |
# import `config_dict` dictionary from configuration module: | |
# `config.py` | |
from config import config_dict | |
configuration = config_dict.get(config_key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JobMedia(db.Model): | |
__tablename__ = 'jobs_media' | |
id = db.Column(db.Integer, primary_key=True) | |
name = db.Column(db.String, nullable=False, unique=True) | |
job_id = db.Column(db.Integer, db.ForeignKey('jobs.id'), nullable=False, unique=True) | |
job = db.relationship('Job', uselist=False, | |
backref=db.backref('media', uselist=False)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@user.route('/profile/<user_uid>') | |
@user.route('/profile/') | |
@user.route('/') | |
@login_required | |
def profile(user_uid=None): | |
if user_uid is None: | |
user = current_user | |
else: | |
user = db_ops.ret_val(db_ops.User, dict(uid=user_uid)) |
OlderNewer