mirror of
https://github.com/wassname/flask-bootstrap.git
synced 2026-06-26 16:00:09 +08:00
Removing fabfile.py and other (very useful) components of Flask Tool since I'm going in another direction with this project (less oriented toward deployment for now)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# flask-bootstrap
|
||||
|
||||
Flask application framework pre-configured for SQL Alchemy, flask-auth authentication, and Twitter bootstrap frontend. Meant to serve as a skeleton application for you to customize as desired, not as a Flask extension.
|
||||
Based on [Flask Tool's](https://github.com/imlucas/flask-tool) simple app template by [imlucas](http://www.imlucas.com/) and Twitter's [Bootstrap framework](http://twitter.github.com/bootstrap/).
|
||||
|
||||
## Install
|
||||
git clone git://github.com/esbullington/flask-bootstrap.git
|
||||
@@ -28,7 +27,7 @@ Change the appropriate settings in fabfile.py and
|
||||
* Bootstrap frontend framework from Twitter
|
||||
|
||||
|
||||
##TO DO
|
||||
##To Do
|
||||
|
||||
* Set up default user authorization for admin user (authentication has already been setup using flask-auth)
|
||||
* Integrate some sort of Python asset manager for static assets (i.e., JS/CSS minifier, file concatenator), ideally one that compiles CoffeeScript
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
|
||||
types {
|
||||
text/html html htm shtml;
|
||||
text/css css;
|
||||
text/xml xml;
|
||||
image/gif gif;
|
||||
image/jpeg jpeg jpg;
|
||||
application/x-javascript js;
|
||||
application/atom+xml atom;
|
||||
application/rss+xml rss;
|
||||
|
||||
text/mathml mml;
|
||||
text/plain txt;
|
||||
text/vnd.sun.j2me.app-descriptor jad;
|
||||
text/vnd.wap.wml wml;
|
||||
text/x-component htc;
|
||||
|
||||
image/png png;
|
||||
image/tiff tif tiff;
|
||||
image/vnd.wap.wbmp wbmp;
|
||||
image/x-icon ico;
|
||||
image/x-jng jng;
|
||||
image/x-ms-bmp bmp;
|
||||
image/svg+xml svg;
|
||||
|
||||
application/java-archive jar war ear;
|
||||
application/mac-binhex40 hqx;
|
||||
application/msword doc;
|
||||
application/pdf pdf;
|
||||
application/postscript ps eps ai;
|
||||
application/rtf rtf;
|
||||
application/vnd.ms-excel xls;
|
||||
application/vnd.ms-powerpoint ppt;
|
||||
application/vnd.wap.wmlc wmlc;
|
||||
application/vnd.wap.xhtml+xml xhtml;
|
||||
application/vnd.google-earth.kml+xml kml;
|
||||
application/vnd.google-earth.kmz kmz;
|
||||
application/x-7z-compressed 7z;
|
||||
application/x-cocoa cco;
|
||||
application/x-java-archive-diff jardiff;
|
||||
application/x-java-jnlp-file jnlp;
|
||||
application/x-makeself run;
|
||||
application/x-perl pl pm;
|
||||
application/x-pilot prc pdb;
|
||||
application/x-rar-compressed rar;
|
||||
application/x-redhat-package-manager rpm;
|
||||
application/x-sea sea;
|
||||
application/x-shockwave-flash swf;
|
||||
application/x-stuffit sit;
|
||||
application/x-tcl tcl tk;
|
||||
application/x-x509-ca-cert der pem crt;
|
||||
application/x-xpinstall xpi;
|
||||
application/zip zip;
|
||||
|
||||
application/octet-stream bin exe dll;
|
||||
application/octet-stream deb;
|
||||
application/octet-stream dmg;
|
||||
application/octet-stream eot;
|
||||
application/octet-stream iso img;
|
||||
application/octet-stream msi msp msm;
|
||||
|
||||
audio/midi mid midi kar;
|
||||
audio/mpeg mp3;
|
||||
audio/x-realaudio ra;
|
||||
|
||||
video/3gpp 3gpp 3gp;
|
||||
video/mpeg mpeg mpg;
|
||||
video/quicktime mov;
|
||||
video/x-flv flv;
|
||||
video/x-mng mng;
|
||||
video/x-ms-asf asx asf;
|
||||
video/x-ms-wmv wmv;
|
||||
video/x-msvideo avi;
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
worker_processes 1;
|
||||
pid etc/nginx.pid;
|
||||
#user ec2-user;
|
||||
error_log logs/nginx-error.log;
|
||||
#daemon off;
|
||||
worker_rlimit_nofile 8192;
|
||||
events {
|
||||
#use epoll;
|
||||
#use kqueue;
|
||||
worker_connections 8000;
|
||||
accept_mutex off;
|
||||
}
|
||||
|
||||
http {
|
||||
# Some sensible defaults.
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
keepalive_timeout 10;
|
||||
client_max_body_size 20m;
|
||||
sendfile on;
|
||||
gzip on;
|
||||
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
gzip_vary on;
|
||||
|
||||
# Directories
|
||||
client_body_temp_path tmp/client_body/ 2 2;
|
||||
fastcgi_temp_path tmp/fastcgi/;
|
||||
proxy_temp_path tmp/proxy/;
|
||||
uwsgi_temp_path tmp/uwsgi/;
|
||||
|
||||
# Logging
|
||||
access_log logs/nginx-access.log combined;
|
||||
|
||||
upstream fysv {
|
||||
# Distribute requests to servers based on client IP. This keeps load
|
||||
# balancing fair but consistent per-client. In this instance we're
|
||||
# only using one uWGSI worker anyway.
|
||||
ip_hash;
|
||||
server unix:tmp/app.sock;
|
||||
}
|
||||
|
||||
server {
|
||||
#listen 80;
|
||||
listen 5000;
|
||||
server_name app;
|
||||
charset utf-8;
|
||||
|
||||
expires 1M;
|
||||
|
||||
location /static/ {
|
||||
expires max;
|
||||
alias static/;
|
||||
access_log logs/static.log;
|
||||
}
|
||||
|
||||
# Finally, send all non-media requests to the Django server.
|
||||
location / {
|
||||
uwsgi_pass app;
|
||||
include uwsgi_params;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
# This is just a placeholder to make sure this directory can be checked in.
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
uwsgi_param QUERY_STRING $query_string;
|
||||
uwsgi_param REQUEST_METHOD $request_method;
|
||||
uwsgi_param CONTENT_TYPE $content_type;
|
||||
uwsgi_param CONTENT_LENGTH $content_length;
|
||||
|
||||
uwsgi_param REQUEST_URI $request_uri;
|
||||
uwsgi_param PATH_INFO $document_uri;
|
||||
uwsgi_param DOCUMENT_ROOT $document_root;
|
||||
uwsgi_param SERVER_PROTOCOL $server_protocol;
|
||||
|
||||
uwsgi_param REMOTE_ADDR $remote_addr;
|
||||
uwsgi_param REMOTE_PORT $remote_port;
|
||||
uwsgi_param SERVER_PORT $server_port;
|
||||
uwsgi_param SERVER_NAME $server_name;
|
||||
Vendored
-85
@@ -1,85 +0,0 @@
|
||||
from fabric.api import run, require, env, local, put
|
||||
from fabric.contrib.files import exists
|
||||
from fabric.context_managers import cd
|
||||
import time
|
||||
|
||||
from app import app
|
||||
|
||||
env.branch = 'master'
|
||||
env.app_name = app.logger.name
|
||||
|
||||
env.key_filename = '' # Full path to pem
|
||||
env.hosts = [] # Hosts
|
||||
|
||||
env.user = 'ec2-user'
|
||||
env.app_dir = '/home/ec2-user/apps/%s' % (env.app_name)
|
||||
env.timestamp = time.strftime('%Y%m%d%H%M')
|
||||
env.warn_only = True
|
||||
env.version = '%s-%s' % (env.app_name, env.timestamp)
|
||||
|
||||
def setup():
|
||||
"""Set up the initial structure on the remote hosts."""
|
||||
require('hosts')
|
||||
require('app_dir')
|
||||
|
||||
with cd(env.app_dir):
|
||||
run("mkdir versions")
|
||||
run("mkdir archives")
|
||||
|
||||
def switch_to(version):
|
||||
"""Switch the current (ie live) version"""
|
||||
require('hosts')
|
||||
require('app_dir')
|
||||
with cd(env.app_dir):
|
||||
if exists('versions/previous'):
|
||||
run('rm versions/previous')
|
||||
|
||||
if exists('versions/current'):
|
||||
run('mv versions/current versions/previous')
|
||||
|
||||
run('ln -s ../versions/%s versions/current' % version)
|
||||
with cd('versions/current'):
|
||||
run("mkdir logs")
|
||||
run("mkdir etc")
|
||||
|
||||
def switch_to_version(version):
|
||||
switch_to(version)
|
||||
# restart nginx/apache
|
||||
|
||||
def make_tar():
|
||||
require('version')
|
||||
#local('tar -cf %s.tar.gz .' % (env.version), capture=False)
|
||||
local("git archive --format=tar --prefix=%(release)s/ %(branch)s | gzip -c > %(release)s.tar.gz" % {
|
||||
'release': env.version,
|
||||
'branch': env.branch,
|
||||
}
|
||||
)
|
||||
local('rm -fr %s' % env.version)
|
||||
|
||||
def upload_tar():
|
||||
require('version', provided_by=[deploy])
|
||||
|
||||
put('%s.tar.gz' % env.version, '%s/archives/' % env.app_dir)
|
||||
with cd(env.app_dir):
|
||||
with cd('versions'):
|
||||
run('tar -zxvf ../archives/%s.tar.gz ' % (env.version))
|
||||
|
||||
local('rm %s.tar.gz' % env.version)
|
||||
|
||||
|
||||
def deploy():
|
||||
make_tar()
|
||||
upload_tar()
|
||||
switch_to(env.version)
|
||||
|
||||
def start():
|
||||
with cd('%s/versions/current' % env.app_dir):
|
||||
run('supervisord')
|
||||
|
||||
def stop():
|
||||
with cd('%s/versions/current' % env.app_dir):
|
||||
run('supervisorctl shutdown')
|
||||
|
||||
def restart():
|
||||
with cd('%s/versions/current' % env.app_dir):
|
||||
run('supervisorctl restart ')
|
||||
@@ -1 +0,0 @@
|
||||
# This is just a placeholder to make sure this directory can be checked in.
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from flaskext.script import Manager
|
||||
|
||||
from app import app
|
||||
|
||||
|
||||
manager = Manager(app)
|
||||
|
||||
if __name__ == "__main__":
|
||||
manager.run()
|
||||
+2
-5
@@ -19,8 +19,7 @@
|
||||
<!-- Mobile viewport optimized: j.mp/bplateviewport -->
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
|
||||
<!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->
|
||||
<!-- for simplicity (flask) we are going to leave it in static, though, boo! Gregg Lind -->
|
||||
<!-- Place favicon.ico and apple-touch-icon.png in static dir for Flask -->
|
||||
<link rel="shortcut icon" href="/static/favicon.ico">
|
||||
<link rel="apple-touch-icon" href="/static/apple-touch-icon.png">
|
||||
|
||||
@@ -32,10 +31,8 @@
|
||||
<link rel="stylesheet" href="/static/css/outer.css">
|
||||
<!-- end CSS-->
|
||||
|
||||
<!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->
|
||||
|
||||
<!-- All JavaScript at the bottom, except for Modernizr / Respond.
|
||||
Modernizr enables HTML5 elements & feature detects; Respond is a polyfill for min/max-width CSS3 Media Queries
|
||||
<!-- All JavaScript at the bottom, except for Modernizr
|
||||
For optimal performance, use a custom Modernizr build: www.modernizr.com/download/ -->
|
||||
<script src="/static/js/libs/modernizr-2.0.6.min.js"></script>
|
||||
</head>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import os
|
||||
import unittest
|
||||
import tempfile
|
||||
|
||||
from app import app
|
||||
|
||||
|
||||
class AppTestCase(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
||||
self.app = app.test_client()
|
||||
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -1 +0,0 @@
|
||||
# This is just a placeholder to make sure this directory can be checked in.
|
||||
Reference in New Issue
Block a user