Skip to content

Commit 077db46

Browse files
author
Brandon Istenes
committed
Decent starting point
0 parents  commit 077db46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3316
-0
lines changed

.bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory" : "src/application/assets/libs"
3+
}

.gitignore

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
### Symlinked env_conf -- all the actual files are in src/application/config
2+
3+
src/application/env_conf.py
4+
5+
### Build directories ###
6+
7+
bin/
8+
data/
9+
include/
10+
bower_components/
11+
lib/
12+
libs/
13+
tmp/
14+
fonts/
15+
.webassets-cache/
16+
17+
### Scratch/Draft Directory -- like tmp, but not programatically cleared
18+
19+
tmp-code/
20+
21+
### App ###
22+
23+
secrets.py
24+
secret_keys.py
25+
*.p12
26+
27+
### OSX ###
28+
29+
.DS_Store
30+
31+
### PyCharm ###
32+
# From https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
33+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
34+
35+
# User-specific stuff:
36+
.idea/workspace.xml
37+
.idea/tasks.xml
38+
.idea/dictionaries
39+
40+
# Sensitive or high-churn files:
41+
.idea/dataSources.ids
42+
.idea/dataSources.xml
43+
.idea/sqlDataSources.xml
44+
.idea/dynamic.xml
45+
.idea/uiDesigner.xml
46+
47+
# Gradle:
48+
.idea/gradle.xml
49+
.idea/libraries
50+
51+
# Mongo Explorer plugin:
52+
.idea/mongoSettings.xml
53+
54+
## File-based project format:
55+
*.iws
56+
57+
## Plugin-specific files:
58+
59+
# IntelliJ
60+
/out/
61+
62+
# mpeltonen/sbt-idea plugin
63+
.idea_modules/
64+
65+
# JIRA plugin
66+
atlassian-ide-plugin.xml
67+
68+
# Crashlytics plugin (for Android Studio and IntelliJ)
69+
com_crashlytics_export_strings.xml
70+
crashlytics.properties
71+
crashlytics-build.properties
72+
fabric.properties
73+
74+
### Python ###
75+
76+
# Byte-compiled / optimized / DLL files
77+
__pycache__/
78+
*.py[cod]
79+
pip-selfcheck.json
80+
81+
# C extensions
82+
*.so
83+
84+
# Distribution / packaging
85+
.Python
86+
env/
87+
build/
88+
develop-eggs/
89+
dist/
90+
downloads/
91+
eggs/
92+
lib64/
93+
parts/
94+
sdist/
95+
var/
96+
*.egg-info/
97+
.installed.cfg
98+
*.egg
99+
100+
# PyInstaller
101+
# Usually these files are written by a python script from a template
102+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
103+
*.manifest
104+
*.spec
105+
106+
# Installer logs
107+
pip-log.txt
108+
pip-delete-this-directory.txt
109+
110+
# Unit test / coverage reports
111+
htmlcov/
112+
.tox/
113+
.coverage
114+
.cache
115+
nosetests.xml
116+
coverage.xml
117+
nosetests.1
118+
119+
# Translations
120+
*.mo
121+
*.pot
122+
123+
# Django stuff:
124+
*.log
125+
126+
# Sphinx documentation
127+
docs/_build/
128+
129+
# PyBuilder
130+
target/

bower.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "my-website",
3+
"version": "0.1",
4+
"description": "A really cool website based on code by Socos LLC",
5+
"license": "MIT",
6+
"ignore": [
7+
"**/.*",
8+
"node_modules",
9+
"bower_components",
10+
"test",
11+
"tests"
12+
],
13+
"dependencies": {
14+
"jquery": "^2.2.1",
15+
"bootstrap": "^3.3.6"
16+
}
17+
}

link_env_conf.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
if [ -z $1 ]; then
4+
echo "Usage: $0 ENV_CONF_EXTENSION"
5+
exit 1
6+
fi
7+
8+
FULL_PATH=src/application/config/env_conf.py.$1
9+
if [ ! -e $FULL_PATH ]; then
10+
echo "No such env conf: $FULL_PATH"
11+
exit 1
12+
fi
13+
14+
cd src/application ;
15+
16+
# Remove compiled version
17+
if [ -e env_conf.pyc ]; then
18+
rm env_conf.pyc
19+
fi
20+
21+
ln -sf config/env_conf.py.$1 env_conf.py ;
22+
cd ../..

requirements.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Application
2+
flask
3+
flask-assets
4+
cssmin
5+
jsmin
6+
flask-debugtoolbar
7+
flask-wtf
8+
wtforms
9+
10+
# Testing
11+
beautifulsoup4
12+
lxml # for bs4
13+
flask-testing
14+
nose
15+
nosegae>=0.5.8
16+
selenium
17+
wsgi-liveserver
18+
19+
# Development
20+
when-changed # for rebuilding assets on changes in development

run_tests.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
TESTARGS=${@:-"src/tests/"}
4+
5+
set +e # Don't die before we clean up
6+
./link_env_conf.sh test
7+
mkdir -p tmp/
8+
../env_gae/bin/nosetests \
9+
--with-gae \
10+
--verbose \
11+
--gae-application src/ \
12+
${TESTARGS}
13+
RETVAL=$?
14+
./link_env_conf.sh dev
15+
16+
exit ${RETVAL}

setup.sh

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
3+
echo
4+
echo "Installing npm dependencies"
5+
echo "---------------------------"
6+
# postcss/autoprefixer for compiling assets. See src/assets.py
7+
if ! hash postcss 2>/dev/null; then
8+
sudo npm -g install postcss-cli autoprefixer
9+
fi
10+
# bower for asset management
11+
if ! hash bower 2>/dev/null; then
12+
sudo npm install -g bower
13+
fi
14+
# phantomjs for Selenium tests
15+
if ! hash phantomjs 2>/dev/null; then
16+
sudo npm install -g phantomjs-prebuilt
17+
fi
18+
19+
echo
20+
echo "Setting up virtualenv"
21+
echo "---------------------"
22+
virtualenv env
23+
./env/bin/easy_install -U pip
24+
./env/bin/pip install --upgrade -r requirements.txt
25+
source env/bin/activate
26+
27+
echo
28+
echo "Creating symlinks"
29+
echo "-----------------"
30+
if [ ! -L src/lib ]; then
31+
cd src/
32+
ln -s ../env lib
33+
cd ..
34+
fi
35+
36+
echo
37+
echo "Running bower install"
38+
echo "---------------------"
39+
bower install
40+
41+
if [ ! -f src/application/secret_keys.py ]; then
42+
cd src/
43+
../../env/bin/python ./generate_keys.py
44+
cd ../
45+
fi
46+
47+
echo
48+
echo "Building assets"
49+
echo "---------------"
50+
./env/bin/python ./src/assets.py
51+
52+
deactivate
53+

src/app.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
service: myservice
2+
runtime: python27
3+
api_version: 1
4+
threadsafe: true
5+
6+
default_expiration: "5d"
7+
8+
builtins:
9+
- appstats: on
10+
- admin_redirect: on
11+
- deferred: on
12+
- remote_api: on
13+
14+
libraries:
15+
- name: jinja2
16+
version: "2.6"
17+
- name: markupsafe
18+
version: "0.15"
19+
- name: pycrypto
20+
version: "2.6"
21+
- name: ssl
22+
version: latest
23+
24+
env_variables:
25+
GAE_USE_SOCKETS_HTTPLIB : 'anyvalue'
26+
27+
inbound_services:
28+
- warmup
29+
30+
handlers:
31+
- url: /favicon.ico
32+
static_files: application/static/img/favicon.ico
33+
upload: application/static/img/favicon.ico
34+
35+
- url: /robots.txt
36+
static_files: application/static/robots.txt
37+
upload: application/static/robots.txt
38+
39+
- url: /gae_mini_profiler/static
40+
static_dir: lib/gae_mini_profiler/static
41+
42+
- url: /gae_mini_profiler/.*
43+
script: lib.gae_mini_profiler.main.application
44+
45+
- url: /static
46+
static_dir: application/static
47+
application_readable: yes
48+
49+
- url: .*
50+
script: run.application.app

src/appengine_config.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
App Engine config
3+
4+
"""
5+
6+
def gae_mini_profiler_should_profile_production():
7+
"""Uncomment the first two lines to enable GAE Mini Profiler on production for admin accounts"""
8+
# from google.appengine.api import users
9+
# return users.is_current_user_admin()
10+
return False
11+
12+
13+
def webapp_add_wsgi_middleware(app):
14+
from google.appengine.ext.appstats import recording
15+
app = recording.appstats_wsgi_middleware(app)
16+
return app

src/application/.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Standard ignores
2+
*.pyc
3+
*.pyo
4+
*.DS_Store
5+
*.swp
6+
*.idea
7+
*.project
8+
*.pydevproject
9+
*.kpf
10+
venv
11+
12+
# Don't store secret keys in version control
13+
secret_keys.py

0 commit comments

Comments
 (0)