Skip to content

Commit

Permalink
PEP8, style and remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
fasouto committed Oct 20, 2016
1 parent 7c95c1f commit 52ef59b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 47 deletions.
17 changes: 8 additions & 9 deletions fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from fabric.contrib.files import exists
from fabric.operations import _prefix_commands, _prefix_env_vars, sudo

# Set to true if you can restart your webserver (via wsgi.py), false to stop/start your webserver
# Set to true if you can restart your webserver (via wsgi.py),
# false to stop/start your webserver
DJANGO_SERVER_RESTART = False

# EDIT THIS INFORMATION
Expand All @@ -22,9 +23,7 @@
env.django_settings_module = ''

# Python version
PYTHON_BIN = "python2.7"
PYTHON_PREFIX = "" # e.g. /usr/local Use "" for automatic
PYTHON_FULL_PATH = "%s/bin/%s" % (PYTHON_PREFIX, PYTHON_BIN) if PYTHON_PREFIX else PYTHON_BIN
PYTHON_BIN = "python3.4"


def virtualenv(venv_dir):
Expand Down Expand Up @@ -59,6 +58,7 @@ def ensure_virtualenv():
run("echo %s > %s/lib/%s/site-packages/projectsource.pth" %
(env.project_dir, env.virtualenv, PYTHON_BIN))


def ensure_src_dir():
if not exists(env.code_dir):
run("mkdir -p %s" % env.code_dir)
Expand All @@ -72,10 +72,9 @@ def update_bootstrap(tag=None):
"""
Update Bootstrap files to tag version. If a tag isn't specified just
get latest version.
Taken from: https://lextoumbourou.com/blog/posts/integrating-bootstrap-django-using-less-and-fabric/
"""
parent_path = os.path.join(os.path.dirname(__file__), '{{ project_name }}/static/vendor')
parent_path = os.path.join(os.path.dirname(__file__),
'{{ project_name }}/static/vendor')
local_path = os.path.join(parent_path, 'bootstrap')

with settings(warn_only=True):
Expand All @@ -84,8 +83,8 @@ def update_bootstrap(tag=None):
run('mkdir -p %s' % parent_path)

with cd(local_path):
# Since django-admin.py startproject remove the hidden dirs (like .git/) we need
# to add the remote the first time
# Since django-admin.py startproject remove the
# hidden dirs (like .git/) we need to add the remote the first time
if not exists(os.path.join(local_path, '.git')):
run('git init')
run('git remote add origin git@github.com:twbs/bootstrap.git')
Expand Down
8 changes: 5 additions & 3 deletions project_name/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@

if settings.DEBUG:
# Add debug-toolbar
import debug_toolbar #noqa
import debug_toolbar # noqa
urlpatterns.append(url(r'^__debug__/', include(debug_toolbar.urls)))

# Serve media files through Django.
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL,
document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)

# Show error pages during development
urlpatterns += [
Expand Down
40 changes: 5 additions & 35 deletions project_name/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,49 +14,19 @@
"""
import os
#import sys
#import site
#import subprocess

from django.core.wsgi import get_wsgi_application

PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__) + "../../")

# Add the virtualenv packages to the site directory. This uses the technique
# described at http://code.google.com/p/modwsgi/wiki/VirtualEnvironments

# Remember original sys.path.
#prev_sys_path = list(sys.path)

# Get the path to the env's site-packages directory
#site_packages = subprocess.check_output([
# os.path.join(PROJECT_ROOT, '.virtualenv/bin/python'),
# '-c',
# 'from distutils.sysconfig import get_python_lib;'
# 'print get_python_lib(),'
#]).strip()

# Add the virtualenv site-packages to the site packages
#site.addsitedir(site_packages)

# Reorder sys.path so the new directories are at the front.
#new_sys_path = []
#for item in list(sys.path):
# if item not in prev_sys_path:
# new_sys_path.append(item)
# sys.path.remove(item)
#sys.path[:0] = new_sys_path

# Add the app code to the path
#sys.path.append(PROJECT_ROOT)
# import sys
# sys.path.append(PROJECT_ROOT)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings.production")
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"{{ project_name }}.settings.production")

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)

0 comments on commit 52ef59b

Please sign in to comment.