Skip to content

Commit

Permalink
Add starter Django template
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskuehl committed Aug 22, 2015
1 parent 92ff435 commit 3a4a0fe
Show file tree
Hide file tree
Showing 10 changed files with 173 additions and 21 deletions.
25 changes: 4 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Byte-compiled / optimized / DLL files
## ocfweb stuff
/ocfweb/static/scss/*.css

## generic python stuff below
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
Expand All @@ -23,18 +22,10 @@ var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
Expand All @@ -43,16 +34,8 @@ htmlcov/
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/
36 changes: 36 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
- repo: https://github.com/pre-commit/pre-commit-hooks.git
sha: 616c1ebd1898c91de9a0548866a59cbd9f4547f6
hooks:
- id: autopep8-wrapper
language_version: python3
- id: check-added-large-files
- id: check-docstring-first
language_version: python3
- id: check-json
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
- id: debug-statements
language_version: python3
- id: detect-private-key
- id: double-quote-string-fixer
language_version: python3
- id: end-of-file-fixer
- id: flake8
language_version: python3
- id: name-tests-test
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/reorder_python_imports.git
sha: 3d86483455ab5bd06cc1069fdd5ac57be5463f10
hooks:
- id: reorder-python-imports
language_version: python3
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
sha: 2f63005157f76e34303fc891ec9e9bc97d267d4a
hooks:
- id: remove-tabs
- repo: https://github.com/pre-commit/mirrors-scss-lint
sha: 3eb13b9647543ad4d6a62c8be8a9131e3b99b96a
hooks:
- id: scss-lint
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
SRC = website

check:
pre-commit run --all-files

dev:
./manage.py runserver 0.0.0.0:8000

scss:
python setup.py build_sass

update-requirements:
$(eval TMP := $(shell mktemp -d))
virtualenv -p python3 $(TMP)
. $(TMP)/bin/activate && \
pip install --upgrade pip && \
pip install . && \
pip freeze | grep -v '^ocf-website==' | sed 's/^ocflib==.*/ocflib/' > requirements.txt
10 changes: 10 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys

if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ocfweb.settings')

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
Empty file added ocfweb/__init__.py
Empty file.
50 changes: 50 additions & 0 deletions ocfweb/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

SECRET_KEY = 'not_a_secret-a(y))f7-_^ji^ezc5k7l%thr-m@(pk^rf)rz+)p#v82mmc_1dh'
DEBUG = True

ALLOWED_HOSTS = []


INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'ocfweb.urls'

TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.request',
'django.contrib.messages.context_processors.messages',
],
},
}]

WSGI_APPLICATION = 'ocfweb.wsgi.application'

DATABASES = {}

LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = False
USE_L10N = False
USE_TZ = True

STATIC_URL = '/static/'
X_FRAME_OPTIONS = 'DENY'
1 change: 1 addition & 0 deletions ocfweb/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
urlpatterns = []
14 changes: 14 additions & 0 deletions ocfweb/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
WSGI config for ocfweb project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ocfweb.settings')
application = get_wsgi_application()
20 changes: 20 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
colorama==0.3.3
cracklib==2.9.3
Django==1.8.4
dnspython3==1.12.0
ecdsa==0.13
ldap3==0.9.8.8
libsass==0.8.3
ocflib
ocfweb==1.0.0
paramiko==1.15.2
pexpect==3.2
pyasn1==0.1.8
pycrypto==2.6.1
PyMySQL==0.6.6
pysnmp==4.2.5
redis==2.10.3
requests==2.7.0
six==1.9.0
SQLAlchemy==1.0.8
wheel==0.24.0
20 changes: 20 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from setuptools import find_packages
from setuptools import setup

setup(
name='ocfweb',
version='1.0.0',
packages=find_packages(),
include_package_data=True,
url='https://www.ocf.berkeley.edu/',
author='Open Computing Facility',
author_email='help@ocf.berkeley.edu',
install_requires=[
'django>=1.8,<1.8.999',
'libsass',
'ocflib',
],
sass_manifests={
'ocfweb': ('static/scss'),
},
)

0 comments on commit 3a4a0fe

Please sign in to comment.