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
19 changes: 0 additions & 19 deletions main/forms.py

This file was deleted.

2 changes: 1 addition & 1 deletion main/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

{% block title %}Account Profile{% endblock %}

{% block content %}
{% block body %}
{% endblock %}
54 changes: 1 addition & 53 deletions main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,8 @@
from django.http import HttpResponseRedirect, HttpResponse
from django_twilio.decorators import twilio_view
from twilio.twiml import Response
from django.contrib import auth
from django.core.context_processors import csrf
from django.contrib.auth.forms import UserCreationForm
# from forms import MyRegistrationForm

# Create your views here.
def index(request):
return render(request, 'main/index.html')

#signin/login views

def login(request):
c = {}
c.update(csrf(request))
return render_to_response('login.html', c)

def auth_view(request):
username = request.POST.get('username', '')
password = request.POST.get('password', '')
user = auth.authenticate(username=username, password=password)

if user is not None:
auth.login(request, user)
return HttpResponseRedirect('/accounts/loggedin')
else:
return HttpResponseRedirect('/accounts/invalid')

def loggedin(request):
return render_to_response('loggedin.html', {'full_name': request.user.username})

def invalid_login(request):
return render_to_response('invalid_login.html')

def logout(request):
auth.logout(request)
return render_to_response('logout.html')

#user registration
def register_user(request):
if request.method == 'POST':
form = MyRegistrationForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect('/accounts/register_success')

args = {}
args.update(csrf(request))

args['form'] = MyRegistrationForm()
print (args)
return render_to_response('register.html', args)

def register_success(request):
return render_to_response('register_success.html')
# from forms import MyRegistrationForm

@twilio_view
def sms(request):
Expand Down
118 changes: 118 additions & 0 deletions pushups/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
"""
Django settings for pushups project.

For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '#-2+byiet=(7dd^k%*8=q%v^h^q)2ac+$)6i#@imx87vvxgxoo'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = True
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'pushups/templates','django.template.loaders.app_directories.Loader',)]

ALLOWED_HOSTS = ['*']

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

SITE_ID = 1
# Application definition

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_twilio',
'main',
'registration',
'django.contrib.sites',
)

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

ROOT_URLCONF = 'pushups.urls'

WSGI_APPLICATION = 'pushups.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases


# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'pushups', # Or path to database file if using sqlite3.
'HOST': 'localhost', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}

# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(PROJECT_PATH, 'static')]
#AUTH_PROFILE_MODULE = 'userprofile.UserProfile'

#email verif. stuff
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_EMAIL_SUBJECT_PREFIX = '[Pushups App Registration]'
SEND_ACTIVATION_EMAIL = True
REGISTRATION_AUTO_LOGIN = False

EMAIL_TLS= True
EMAIL_HOST= 'smtp.mandrillapp.com'
EMAIL_PORT= '587'
EMAIL_HOST_USER= 'jody@waypaver.co'
EMAIL_HOST_PASSWORD= 'W9xSNi9MtAdKCqVeVoku1g'
#SERVER_EMAIL = 'jody@waypaver.co'

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
2 changes: 1 addition & 1 deletion pushups/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
url(r'^$',TemplateView.as_view(template_name='index.html'),name='index'),

url(r'^accounts/',
include('registration.backends.simple.urls')),
include('registration.backends.default.urls')),

url(r'^accounts/profile/',
TemplateView.as_view(template_name='profile.html'),
Expand Down
37 changes: 0 additions & 37 deletions pushups/views.py

This file was deleted.

4 changes: 2 additions & 2 deletions registration/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def activate_users(self, request, queryset):
"""
Activates the selected users, if they are not alrady
activated.

"""
for profile in queryset:
RegistrationProfile.objects.activate_user(profile.activation_key)
Expand All @@ -30,7 +30,7 @@ def resend_activation_email(self, request, queryset):
who are eligible to activate; emails will not be sent to users
whose activation keys have expired or who have already
activated.

"""
if Site._meta.installed:
site = Site.objects.get_current()
Expand Down
2 changes: 1 addition & 1 deletion registration/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class RegistrationFormNoFreeEmail(RegistrationForm):
override the attribute ``bad_domains``.

"""
bad_domains = ['aim.com', 'aol.com', 'email.com', 'gmail.com',
bad_domains = ['aim.com', 'aol.com', 'email.com',
'googlemail.com', 'hotmail.com', 'hushmail.com',
'msn.com', 'mail.ru', 'mailinator.com', 'live.com',
'yahoo.com']
Expand Down
2 changes: 1 addition & 1 deletion registration/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,4 @@ def send_activation_email(self, site):
if message_html:
email_message.attach_alternative(message_html, 'text/html')

email_message.send()
email_message.send()
4 changes: 2 additions & 2 deletions registration/templates/registration/activation_email.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</p>

<p>
<a href="http://{{site.domain}}{% url 'registration_activate' activation_key %}">
<a href="http://{{ site.name }}{% url 'registration_activate' activation_key %}">
{{site.domain}}{% url 'registration_activate' activation_key %}
</a>
</p>
Expand Down Expand Up @@ -64,4 +64,4 @@

``user``
The new user account
{% endcomment %}
{% endcomment %}
Empty file removed userprofile/__init__.py
Empty file.
3 changes: 0 additions & 3 deletions userprofile/admin.py

This file was deleted.

8 changes: 0 additions & 8 deletions userprofile/forms.py

This file was deleted.

27 changes: 0 additions & 27 deletions userprofile/migrations/0001_initial.py

This file was deleted.

Empty file removed userprofile/migrations/__init__.py
Empty file.
11 changes: 0 additions & 11 deletions userprofile/models.py

This file was deleted.

18 changes: 0 additions & 18 deletions userprofile/templates/profile.html

This file was deleted.

3 changes: 0 additions & 3 deletions userprofile/tests.py

This file was deleted.

5 changes: 0 additions & 5 deletions userprofile/urls.py

This file was deleted.

Loading