echo "<pre>";
print_r(Request::$route);
echo "</pre>";
Request::$route->controller
import os | |
import django | |
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__)) | |
SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) | |
STATIC_ROOT = 'static' | |
# URL prefix for static files. |
This demonstrates that you can configure a Flask application through Flask-Script, without having to create a Flask instance or deal with circular dependencies. Note that Flask-Script's Manager accepts a factory function in place of a Flask app object.
Running:
python manage.py runserver
gives "Hello, world!" on http://localhost:5000/, while running:
python manage.py runserver -c development.cfg
import logging | |
from logging.handlers import RotatingFileHandler | |
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def foo(): | |
app.logger.warning('Some warning occurred (%d things)', 42) |
help: | |
@echo "make si setup all requirements" | |
@echo "make love switch to virtual environment" | |
@echo "make up Run the server" | |
si: | |
pip install -r requirements.txt | |
The procedure for setting up automatic private/public key login on our servers is as follows:
$HOME/.ssh
and type: ssh-keygen -t dsa
id_dsa.pub
file that just got created into the $HOME/.ssh/authorized_keys
and authorized_keys2
on our machine.chmod 644 $HOME/.ssh/authorized_keys*
#!/bin/bash | |
# passwordless sudo | |
echo "%sudo ALL=NOPASSWD: ALL" >> /etc/sudoers | |
# public ssh key for vagrant user | |
mkdir /home/vagrant/.ssh | |
wget -O /home/vagrant/.ssh/authorized_keys "https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub" | |
chmod 755 /home/vagrant/.ssh | |
chmod 644 /home/vagrant/.ssh/authorized_keys |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: nginx init.d dash script for Ubuntu <=9.10. | |
# Description: nginx init.d dash script for Ubuntu <=9.10. | |
### END INIT INFO |
<IfModule mod_php5.c> | |
php_value short_open_tag 1 | |
</IfModule> |