Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
all: django

django:
./web/common/bin/install_dependencies
echo "Installing the dependinces necessary to run this repository"
./web/manage.py setup_virtualenv
echo "Setting up the virtual environment"
./web/common/bin/setup_mysql.py
cd web && ./common/bin/install_dependencies.py
echo "Installing proper configuration for mysql"
./web/manage.py syncdb
cd web && ./manage.py setup_virtualenv
echo "Setting up the virtual environment"
cd web && ./common/bin/setup_mysql.py
echo "Creating the necessary tables into the database"
./web/manage.py dbshell < data.sql
cd web && ./manage.py syncdb
echo "Inserting the data into the database"
cd web && ./manage.py dbshell < web/chicagoEnergy.sql
echo "Now run './web/manage.py runserver' and open up a browser to the local host!"
24 changes: 12 additions & 12 deletions web/common/bin/fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,24 +175,24 @@ def setup_virtualenv(virtualenv_name, run_func=local):
virtualenv_requirement,
))

hg_root = fabhelp.get_hg_root()
# hg_root = fabhelp.get_hg_root()
if run_func == local:
project_dir = run_func("pwd", capture=True)
else:
project_dir = run_func("pwd")
project_name = os.path.basename(project_dir)

# add virtualenv to hgignore
if run_func == local:
fabhelp.progress("add virtualenv to .hgignore")
ignore_patterns = (
os.path.relpath(os.path.join(project_dir,virtualenv_name),hg_root),
)
fabhelp.add_to_hgignore(
ignore_patterns,
syntax="glob",
comment="ignore virtualenv for project '%s'"%project_name,
)
# # add virtualenv to hgignore
# if run_func == local:
# fabhelp.progress("add virtualenv to .hgignore")
# ignore_patterns = (
# os.path.relpath(os.path.join(project_dir,virtualenv_name),hg_root),
# )
# fabhelp.add_to_hgignore(
# ignore_patterns,
# syntax="glob",
# comment="ignore virtualenv for project '%s'"%project_name,
# )

def render_apache_configuration(production_root_url,
local_master_django_project_dir=''):
Expand Down
26 changes: 13 additions & 13 deletions web/common/bin/fabhelp.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ def get_cur_bin_src_directories():
os.path.join(os.path.dirname(bin_dir), "src"),
)

def get_hg_root(ldir=None):
"""find the mercurial root"""
ldir = ldir or ''
with lcd(ldir):
with settings(hide("warnings", "running", "stdout", "stderr"),
warn_only=True):
hg_root = local("hg root", capture=True)
if hg_root.failed:
msg = "directory '%s' is not in a mercurial project" % ldir
msg += '\n"hg root" output:' + hg_root
msg += '\n"hg root" stderr:' + hg_root.stderr
raise ValueError(msg)
return hg_root
# def get_hg_root(ldir=None):
# """find the mercurial root"""
# ldir = ldir or ''
# with lcd(ldir):
# with settings(hide("warnings", "running", "stdout", "stderr"),
# warn_only=True):
# hg_root = local("hg root", capture=True)
# if hg_root.failed:
# msg = "directory '%s' is not in a mercurial project" % ldir
# msg += '\n"hg root" output:' + hg_root
# msg += '\n"hg root" stderr:' + hg_root.stderr
# raise ValueError(msg)
# return hg_root

def is_django_project(d, in_root_dir=False):
"""make sure that directory d is actually a django project and
Expand Down
3 changes: 3 additions & 0 deletions web/common/bin/install_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ def install_gem(self):
class ConvenienceInstaller(Installer):
"""an installer for many common python packages"""

def install_geo_dependencies(self):
self.apt_install_packages("binutils", "libproj-dev", "gdal-bin", "libspatialindex-dev")

def install_python_software_properties(self):
"""this is needed to add the latest version of mercurial"""
self.apt_install_packages("python-software-properties")
Expand Down
2 changes: 1 addition & 1 deletion web/common/conf/noether/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}

# debug information
DEBUG = False
DEBUG = True
TEMPLATE_DEBUG = DEBUG
SITE_ID = 3

Expand Down
23 changes: 12 additions & 11 deletions web/common/conf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,18 @@ def _mysql_db_name(PROJECT_ROOT):

somehgrepo__path__to__djangoproject
"""

# use fabric/mercurial to find the mercurial root from the
# PROJECT_ROOT directory
from common.bin import fabhelp
hg_root = fabhelp.get_hg_root(PROJECT_ROOT)
rel_path = os.path.relpath(PROJECT_ROOT, os.path.dirname(hg_root))

# name the database based on this path to the PROJECT_ROOT
db_name = rel_path.lower().replace(' ','_').replace(os.sep, '__')\
.replace('-','_')
return db_name
return 'chicagoenergy'

# # use fabric/mercurial to find the mercurial root from the
# # PROJECT_ROOT directory
# from common.bin import fabhelp
# hg_root = fabhelp.get_hg_root(PROJECT_ROOT)
# rel_path = os.path.relpath(PROJECT_ROOT, os.path.dirname(hg_root))

# # name the database based on this path to the PROJECT_ROOT
# db_name = rel_path.lower().replace(' ','_').replace(os.sep, '__')\
# .replace('-','_')
# return db_name

def _suburl_settings(server_name, PROJECT_ROOT, MEDIA_URL,
SESSION_COOKIE_PATH, LOGIN_REDIRECT_URL, LOGIN_URL,
Expand Down
2 changes: 1 addition & 1 deletion web/conf/noether/apache/noether.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<VirtualHost chicagoenergy.datascopeanalytics.com:80>
<VirtualHost *:80>
ServerName chicagoenergy.datascopeanalytics.com
ServerAlias www.chicagoenergy.datascopeanalytics.com
ServerAdmin webmaster@datascopeanalytics.com
Expand Down
2 changes: 1 addition & 1 deletion web/conf/virtualenv_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# https://github.com/omab/django-social-auth/pull/673
#-e git://github.com/omab/django-social-auth.git@requests#egg=django-social-auth
-e git://github.com/deanmalmgren/django-social-auth.git@requests#egg=django-social-auth
shapely
shapely<1.3
Rtree==0.7.0