Skip to content

Commit 3a4a0fe

Browse files
committed
Add starter Django template
1 parent 92ff435 commit 3a4a0fe

10 files changed

+173
-21
lines changed

.gitignore

+4-21
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
# Byte-compiled / optimized / DLL files
1+
## ocfweb stuff
2+
/ocfweb/static/scss/*.css
3+
4+
## generic python stuff below
25
__pycache__/
36
*.py[cod]
47
*$py.class
5-
6-
# C extensions
78
*.so
8-
9-
# Distribution / packaging
109
.Python
1110
env/
1211
build/
@@ -23,18 +22,10 @@ var/
2322
*.egg-info/
2423
.installed.cfg
2524
*.egg
26-
27-
# PyInstaller
28-
# Usually these files are written by a python script from a template
29-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
3025
*.manifest
3126
*.spec
32-
33-
# Installer logs
3427
pip-log.txt
3528
pip-delete-this-directory.txt
36-
37-
# Unit test / coverage reports
3829
htmlcov/
3930
.tox/
4031
.coverage
@@ -43,16 +34,8 @@ htmlcov/
4334
nosetests.xml
4435
coverage.xml
4536
*,cover
46-
47-
# Translations
4837
*.mo
4938
*.pot
50-
51-
# Django stuff:
5239
*.log
53-
54-
# Sphinx documentation
5540
docs/_build/
56-
57-
# PyBuilder
5841
target/

.pre-commit-config.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
- repo: https://github.com/pre-commit/pre-commit-hooks.git
2+
sha: 616c1ebd1898c91de9a0548866a59cbd9f4547f6
3+
hooks:
4+
- id: autopep8-wrapper
5+
language_version: python3
6+
- id: check-added-large-files
7+
- id: check-docstring-first
8+
language_version: python3
9+
- id: check-json
10+
- id: check-merge-conflict
11+
- id: check-xml
12+
- id: check-yaml
13+
- id: debug-statements
14+
language_version: python3
15+
- id: detect-private-key
16+
- id: double-quote-string-fixer
17+
language_version: python3
18+
- id: end-of-file-fixer
19+
- id: flake8
20+
language_version: python3
21+
- id: name-tests-test
22+
- id: requirements-txt-fixer
23+
- id: trailing-whitespace
24+
- repo: https://github.com/asottile/reorder_python_imports.git
25+
sha: 3d86483455ab5bd06cc1069fdd5ac57be5463f10
26+
hooks:
27+
- id: reorder-python-imports
28+
language_version: python3
29+
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
30+
sha: 2f63005157f76e34303fc891ec9e9bc97d267d4a
31+
hooks:
32+
- id: remove-tabs
33+
- repo: https://github.com/pre-commit/mirrors-scss-lint
34+
sha: 3eb13b9647543ad4d6a62c8be8a9131e3b99b96a
35+
hooks:
36+
- id: scss-lint

Makefile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
SRC = website
2+
3+
check:
4+
pre-commit run --all-files
5+
6+
dev:
7+
./manage.py runserver 0.0.0.0:8000
8+
9+
scss:
10+
python setup.py build_sass
11+
12+
update-requirements:
13+
$(eval TMP := $(shell mktemp -d))
14+
virtualenv -p python3 $(TMP)
15+
. $(TMP)/bin/activate && \
16+
pip install --upgrade pip && \
17+
pip install . && \
18+
pip freeze | grep -v '^ocf-website==' | sed 's/^ocflib==.*/ocflib/' > requirements.txt

manage.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
if __name__ == '__main__':
6+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ocfweb.settings')
7+
8+
from django.core.management import execute_from_command_line
9+
10+
execute_from_command_line(sys.argv)

ocfweb/__init__.py

Whitespace-only changes.

ocfweb/settings.py

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import os
2+
3+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
4+
5+
SECRET_KEY = 'not_a_secret-a(y))f7-_^ji^ezc5k7l%thr-m@(pk^rf)rz+)p#v82mmc_1dh'
6+
DEBUG = True
7+
8+
ALLOWED_HOSTS = []
9+
10+
11+
INSTALLED_APPS = (
12+
'django.contrib.sessions',
13+
'django.contrib.messages',
14+
'django.contrib.staticfiles',
15+
)
16+
17+
MIDDLEWARE_CLASSES = (
18+
'django.contrib.sessions.middleware.SessionMiddleware',
19+
'django.middleware.common.CommonMiddleware',
20+
'django.middleware.csrf.CsrfViewMiddleware',
21+
'django.contrib.messages.middleware.MessageMiddleware',
22+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
23+
)
24+
25+
ROOT_URLCONF = 'ocfweb.urls'
26+
27+
TEMPLATES = [{
28+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
29+
'DIRS': [],
30+
'APP_DIRS': True,
31+
'OPTIONS': {
32+
'context_processors': [
33+
'django.template.context_processors.request',
34+
'django.contrib.messages.context_processors.messages',
35+
],
36+
},
37+
}]
38+
39+
WSGI_APPLICATION = 'ocfweb.wsgi.application'
40+
41+
DATABASES = {}
42+
43+
LANGUAGE_CODE = 'en-us'
44+
TIME_ZONE = 'UTC'
45+
USE_I18N = False
46+
USE_L10N = False
47+
USE_TZ = True
48+
49+
STATIC_URL = '/static/'
50+
X_FRAME_OPTIONS = 'DENY'

ocfweb/urls.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
urlpatterns = []

ocfweb/wsgi.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
WSGI config for ocfweb project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
8+
"""
9+
import os
10+
11+
from django.core.wsgi import get_wsgi_application
12+
13+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ocfweb.settings')
14+
application = get_wsgi_application()

requirements.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
colorama==0.3.3
2+
cracklib==2.9.3
3+
Django==1.8.4
4+
dnspython3==1.12.0
5+
ecdsa==0.13
6+
ldap3==0.9.8.8
7+
libsass==0.8.3
8+
ocflib
9+
ocfweb==1.0.0
10+
paramiko==1.15.2
11+
pexpect==3.2
12+
pyasn1==0.1.8
13+
pycrypto==2.6.1
14+
PyMySQL==0.6.6
15+
pysnmp==4.2.5
16+
redis==2.10.3
17+
requests==2.7.0
18+
six==1.9.0
19+
SQLAlchemy==1.0.8
20+
wheel==0.24.0

setup.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from setuptools import find_packages
2+
from setuptools import setup
3+
4+
setup(
5+
name='ocfweb',
6+
version='1.0.0',
7+
packages=find_packages(),
8+
include_package_data=True,
9+
url='https://www.ocf.berkeley.edu/',
10+
author='Open Computing Facility',
11+
author_email='help@ocf.berkeley.edu',
12+
install_requires=[
13+
'django>=1.8,<1.8.999',
14+
'libsass',
15+
'ocflib',
16+
],
17+
sass_manifests={
18+
'ocfweb': ('static/scss'),
19+
},
20+
)

0 commit comments

Comments
 (0)