diff --git a/.gitignore b/.gitignore index f6f1cb1..eaa6edf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +\#*\# +*~ .gondor .vagrant *.pyc @@ -5,3 +7,4 @@ pythonkc_site/pythonkc.sqlite pythonkc_site/local_settings.py pythonkc_site/private_settings.py pythonkc_site/.env +pythonkc_site/staticfiles/ diff --git a/.slugignore b/.slugignore new file mode 100644 index 0000000..8952f1d --- /dev/null +++ b/.slugignore @@ -0,0 +1,5 @@ +.*~ +Vagrantfile +ansible/ +docs/ +provision.sh diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..78336c5 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn pythonkc_site.wsgi --log-file - diff --git a/README.markdown b/README.markdown index d11fd8b..9c98569 100644 --- a/README.markdown +++ b/README.markdown @@ -44,10 +44,10 @@ To run the Django development server: ``` vagrant ssh -django-admin runserver 192.168.100.101:8000 +DJANGO_DEBUG=True MEETUP_API_KEY="your_key_here" django-admin runserver 192.168.100.101:8000 ``` -Now go to `http://192.168.100.101:8000` in your browser. You can edit the files +Now go to `http://pythonkc.dev:8000` in your browser. You can edit the files on your local machine and the server should reload automatically. For now, this is a Python 2 project. If you want to start using Python 3 @@ -84,4 +84,3 @@ See: docs/local_development [our repository]: https://github.com/pythonkc/pythonkc.com [meetup api key]: https://secure.meetup.com/meetup_api/key/ [django secret key]: http://www.miniwebtool.com/django-secret-key-generator/ - diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg index 0b186f5..9fc2665 100644 --- a/ansible/ansible.cfg +++ b/ansible/ansible.cfg @@ -1,3 +1,3 @@ [defaults] hostfile = ./hosts -transport = ssh +remote_user = root diff --git a/ansible/group_vars/vagrant.yml b/ansible/group_vars/vagrant.yml index 61df658..bf06bba 100644 --- a/ansible/group_vars/vagrant.yml +++ b/ansible/group_vars/vagrant.yml @@ -1,4 +1,4 @@ --- user: vagrant pythonpath: /home/vagrant/vagrant -project_root: /home/vagrant/vagrant/pythonkc_site +project_root: /home/vagrant/vagrant/ diff --git a/ansible/roles/pythonkc/tasks/django.yml b/ansible/roles/pythonkc/tasks/django.yml index 168c1ff..16ede79 100644 --- a/ansible/roles/pythonkc/tasks/django.yml +++ b/ansible/roles/pythonkc/tasks/django.yml @@ -5,7 +5,7 @@ - name: Install requirements into Python 2.7 virtualenv pip: - requirements: "{{ project_root }}/requirements/project.txt" + requirements: "{{ project_root }}/requirements.txt" virtualenv: "{{ virtualenv }}" virtualenv_command: /usr/bin/virtualenv -p python2.7 when: python_version == 2 @@ -13,7 +13,7 @@ - name: Install requirements into Python 3 virtualenv pip: - requirements: "{{ project_root }}/requirements/project.txt" + requirements: "{{ project_root }}/requirements.txt" virtualenv: "{{ virtualenv }}" virtualenv_command: python3 /usr/lib/python3/dist-packages/virtualenv.py -p python3 when: python_version == 3 diff --git a/pythonkc_site/manage.py b/manage.py similarity index 100% rename from pythonkc_site/manage.py rename to manage.py diff --git a/provision.sh b/provision.sh index 62d57d4..5cf7b51 100644 --- a/provision.sh +++ b/provision.sh @@ -13,7 +13,7 @@ ln -sf /vagrant/pythonkc_site /var/www/pythonkc_site if [[ -z "$(which ansible)" ]]; then echo "Installing pip and Ansible..." aptitude install -y python-dev python-pip - pip2 install ansible + pip2 install ansible markupsafe fi cd /home/vagrant/vagrant/ansible diff --git a/pythonkc_site/settings.py b/pythonkc_site/settings.py index 2b12fef..4c4320a 100644 --- a/pythonkc_site/settings.py +++ b/pythonkc_site/settings.py @@ -9,7 +9,7 @@ PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) -DEBUG = TEMPLATE_DEBUG = False +DEBUG = TEMPLATE_DEBUG = os.environ.get('DJANGO_DEBUG', 'False') ADMINS = ( ('Steven Cummings', 'estebistec@gmail.com'), @@ -17,7 +17,7 @@ MANAGERS = ADMINS -SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY') +SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', os.urandom(32)) DATABASES = { 'default': { @@ -57,7 +57,7 @@ # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/home/media/media.lawrence.com/media/" -MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media'), +MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media') # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. @@ -68,10 +68,10 @@ # 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 = os.path.join(PROJECT_ROOT, 'static'), +STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles') # See https://gondor.io/support/quick-how-to/#handling-site-media-staticfiles -STATIC_URL = "/site_media/static/" +STATIC_URL = "/static/" # URL prefix for admin static files -- CSS, JavaScript and images. # Make sure to use a trailing slash. diff --git a/pythonkc_site/urls.py b/pythonkc_site/urls.py index 19fc176..d94f30a 100644 --- a/pythonkc_site/urls.py +++ b/pythonkc_site/urls.py @@ -2,7 +2,6 @@ from django.conf.urls import include -from django.conf.urls import patterns from django.conf.urls import url from django.views.decorators.cache import cache_page from pythonkc_site.views import PythonKCHome @@ -11,9 +10,9 @@ # from django.contrib import admin # admin.autodiscover() -urlpatterns = patterns('', +urlpatterns = [ url(r'^/?$', cache_page(60 * 5)(PythonKCHome.as_view()), name='home'), - +] # Examples: # url(r'^$', 'pythonkc_site.views.home', name='home'), # url(r'^pythonkc_site/', include('pythonkc_site.foo.urls')), @@ -23,6 +22,4 @@ # Uncomment the next line to enable the admin: # url(r'^admin/', include(admin.site.urls)), -) - - +#) diff --git a/pythonkc_site/wsgi.py b/pythonkc_site/wsgi.py new file mode 100644 index 0000000..3a527a9 --- /dev/null +++ b/pythonkc_site/wsgi.py @@ -0,0 +1,6 @@ +import os +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pythonkc_site.settings") +from django.core.wsgi import get_wsgi_application +from whitenoise.django import DjangoWhiteNoise +application = get_wsgi_application() +application = DjangoWhiteNoise(application) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9f2cdcf --- /dev/null +++ b/requirements.txt @@ -0,0 +1,11 @@ +Django==1.8.3 +django-dotenv==1.3.0 +django-redis-cache==0.9.2 +gunicorn==19.6.0 +mimeparse==0.1.3 +psycopg2==2.6.1 +python-dateutil==1.5 +pythonkc-meetups==0.1.0 +redis==2.10.3 +requests==2.7.0 +whitenoise==3.2.2