- develop ブランチから新たに作成する機能のためのフィーチャーブランチを作成します。
git branch feature/new_feature develop
// these are labels for the days of the week | |
cal_days_labels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; | |
// these are human-readable month name labels, in order | |
cal_months_labels = ['January', 'February', 'March', 'April', | |
'May', 'June', 'July', 'August', 'September', | |
'October', 'November', 'December']; | |
// these are the days of the week for each month, in order | |
cal_days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.require_version ">= 1.6.0" | |
# K8s Master Nodes | |
M_NODES = ENV['M_NODES'] || 1 |
When setting these options consider the following:
sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
Download memcached source | |
./configure --enable-sasl --enable-sasl-pwdb | |
make | |
echo "user:password" > memcached-sasl-pwdb | |
export MEMCACHED_SASL_PWDB=memcached-sasl-pwdb | |
./memcached -S -vv | |
Don't need anything with sasl, saslpasswd2, or memcached.conf |
import sqlalchemy | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, String, ForeignKey | |
from sqlalchemy.orm import sessionmaker, relationship, backref | |
from sqlalchemy.ext.associationproxy import association_proxy | |
import uuid | |
engine = sqlalchemy.create_engine('sqlite:///:memory:') | |
Base = declarative_base() | |
"""SQLAlchemy Metadata and Session object""" | |
import datetime | |
import json | |
import time | |
from sqlalchemy import MetaData | |
from sqlalchemy.orm import scoped_session, sessionmaker | |
__all__ = ['Session', 'metadata', 'Model', 'SchemaEncoder'] |
# Requires use of Flask Login for the user tracking | |
# Implement by using AuditableMixin in your model class declarations | |
# e.g. class ImportantThing(AuditableMixin, Base): | |
import json | |
from flask_login import current_user | |
from sqlalchemy import event, inspect | |
from sqlalchemy.orm import class_mapper | |
from sqlalchemy.orm.attributes import get_history |
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
Here's an example application that uses the pattern detailed below: https://github.com/tantastik/talent-curator
This document is an attempt to describe the first step of a large project structure with flask and some basic modules:
Please feel free to fix and add your own tips.