Commit adaed59f authored by Tyler Hallada's avatar Tyler Hallada

Configuring to run locally without local_settings, and able to run with apache...

Configuring to run locally without local_settings, and able to run with apache or gunicorn. Making heroku run with gunicorn.
parent 34dab203
......@@ -7,4 +7,5 @@
*.env
venv
build
apache
.ropeproject
web: python manage.py runserver 0.0.0.0:$PORT
web: gunicorn whats_open.wsgi:application -b 0.0.0.0:$PORT -w 3 -k gevent
......@@ -29,26 +29,18 @@ To get started, you'll need the following installed:
easyinstall, which is bundled with
[setuptools](http://pypi.python.org/pypi/setuptools)
NOTE: While git.gmu.edu is not functioning correctly, What's Open will be using
my repository at https://github.com/thallada/whats-open So, if you want to
push code I'll have to add you as a collaborator to the repository manually.
Please let me know your github username and I can add you. In the future, when
git.gmu.edu is working, you will be able to contribute to the project as long
as you're in the SRCT group.
You don't need a github account to preform a `git clone`, but you should get
one if you plan on actually modifying code. [Github's Set-Up
Page](https://help.github.com/articles/set-up-git) should help with that. It's
also a good idea to set up your [ssh keys to be used by
github](https://help.github.com/articles/generating-ssh-keys) at this time so
you won't have to keep typing in your password when you push to a github
repository.
You don't need to do anything with [git.gmu.edu](https://git.gmu.edu/) to
preform a `git clone`, but you should log in if you plan on actually modifying
code. Logging into git.gmu.edu with your George Mason credentials will create
an account. Ask a SRCT member to add you to the SRCT group on the site and you
will be added to the list of people allowed to `git push` to the repository at
git.gmu.edu.
Then type the following commands in your terminal (if you're on Windows,
[Cygwin](http://www.cygwin.com/) is recommended).
```bash
git clone https://github.com/thallada/whats-open.git
git clone git://git.gmu.edu/whats-open/whats-open.git
cd whats-open/
virtualenv venv --distribute
source venv/bin/activate
......@@ -57,12 +49,15 @@ python manage.py syncdb
python manage.py migrate website
```
If git.gmu.edu is not loading correctly the alternative url is:
https://github.com/thallada/whats-open.git
###Running the Site Locally###
Now that everything is set-up you can run the server on your computer.
```bash
python manage.py runserver --settings=whats_open.local_settings
python manage.py runserver
```
Go to http://127.0.0.1/ in your browser and you should see the website.
......@@ -94,10 +89,6 @@ There are many ways to use git, and this is one example:
git commit -a
git push origin master
```
If you're having trouble pushing to my github repository please see the note
in "Set-Up" about how to set up github so you can do that.
Some more helpful links on how to use Git:
* [Git Reference](http://gitref.org/)
* [OpenHatch's Training Mission](https://openhatch.org/missions/git)
......@@ -109,18 +100,12 @@ Some more helpful links on how to use Git:
We currently don't have What's Open running on a dedicated server yet, but when
we do I will have instructions on how to deploy the code here.
###Pedantic Technical Details###
Notice that `whats_open.local_settings` was specified as the settings file when
running the site locally. This settings file, located under the `whats_open`
folder as `local_settings.py`, is identical to the `settings.py` except for a
few things that allow you to run the site locally, like using an sqlite
database instead of the PostgresSQL one used for production currently.
###Running Site Locally with Production Database###
However, it is possible to run the site locally using the PostgresSQL database
and normal `settings.py` file. The most sane way of doing this requires that the
heroku-toolbelt installed and that you have access to the heroku site as a
contributor, so see me if you desire this.
It is possible to run the site locally using the PostgresSQL database that
whatsopen.gmu.edu uses. The way settings.py is configured requires that you set
an environmental variable to the database's url before you run the site. Talk
to me if you would like to know the url to accomplish this.
###To Do###
* Get all restaurants displaying correct open times on the page. AKA. make
......
......@@ -3,6 +3,9 @@ South==0.7.6
argparse==1.2.1
distribute==0.6.24
dj-database-url==0.2.1
gevent==0.13.8
greenlet==0.4.0
gunicorn==0.15.0
psycopg2==2.4.5
python-memcached==1.48
wsgiref==0.1.2
# Django settings for whats_open project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': os.path.join(PROJECT_PATH, '..', 'database.db'), # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/New_York'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = ''
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'a3n#)-dein7gn69$d(+05yu%^0vjg@^f+p%(@@$v2z2vfs54j^'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'whats_open.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'whats_open.wsgi.application'
TEMPLATE_DIRS = (
os.path.join(PROJECT_PATH, 'templates'),
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
'south',
'website',
)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
CACHE_MIDDLEWARE_ALIAS = 'default'
CACHE_MIDDLEWARE_SECONDS = 259200
CACHE_MIDDLEWARE_KEY_PREFIX = ''
......@@ -13,7 +13,15 @@ MANAGERS = ADMINS
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'database.db'
}
}
if os.environ.get('DATABASE_URL', None):
DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
......@@ -57,6 +65,8 @@ STATIC_ROOT = ''
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
ADMIN_MEDIA_PREFIX = '/static/admin/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment