Permalink
Browse files

Remove requirement on Postmark for basic installs.

  • Loading branch information...
nicksergeant committed Nov 4, 2016
1 parent fbb0110 commit ffe433e734d085266a5bdd6ab098b6ec1d312044
Showing with 18 additions and 55 deletions.
  1. +7 βˆ’20 README.md
  2. +0 βˆ’6 forms.py
  3. +1 βˆ’1 settings.py
  4. +8 βˆ’26 urls.py
  5. +2 βˆ’2 utils/views.py
View
@@ -6,32 +6,13 @@ You can click the button below to automatically deploy Snipt to Heroku.
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/nicksergeant/snipt/tree/heroku)
**Please note:** this method will work fine, but you will not have email support
unless you manually configure Postmark. You don't necessarily need this,
though. After deploying the instance, visit
`https://<your-instance-name>/signup`, and create a user. You will get a 500
Server Error, which is the site trying to send a welcome email. Ignore the
error and go to `<https://your-instance-name>/login`, and log in with the
username and password you provided. Snipt will work fine, but you will not
receive any emails if there are server errors.
If you would like to configure your instance to use a free Postmark addon, do
the following after deploying (you'll need the
[Heroku CLI](https://devcenter.heroku.com/articles/heroku-command-line)):
- `heroku run -a <your-instance-name> addons:open postmark` -> use an email you control and confirm it
- `heroku <your-instance-name> config:add -a <your-instance-name> POSTMARK_EMAIL=<email_from_above>`
## Manual deploy to Heroku
- Clone the repo.
- `heroku create`
- `heroku addons:add heroku-postgresql:hobby-dev`
- `heroku addons:add searchbox`
- `heroku addons:create postmark:10k`
- `heroku addons:open postmark` -> use an email you control and confirm it
- `heroku config:add POSTMARK_EMAIL=<email_from_above>`
- `heroku config:add SECRET_KEY=`
- `heroku config:add SECRET_KEY=<some-secret-key>`
- `git push heroku`
- `heroku run python manage.py migrate`
- `heroku run python manage.py createsuperuser`
@@ -47,6 +28,12 @@ the following after deploying (you'll need the
## Options
If you want email support (for password resets, server errors, etc):
- `heroku addons:create postmark:10k`
- `heroku run addons:open postmark` -> use an email you control and confirm it
- `heroku config:add POSTMARK_EMAIL=<email_from_above>`
If you want to disable user-facing signup:
- `heroku config:set DISABLE_SIGNUP=true`
View
@@ -1,6 +0,0 @@
from django.contrib.auth.forms import AuthenticationForm
class AuthenticationFormWithInactiveUsersOkay(AuthenticationForm):
def confirm_login_allowed(self, user):
pass
View
@@ -42,7 +42,7 @@
ABSOLUTE_URL_OVERRIDES = {'auth.user': lambda u: "/%s/" % u.username}
ACCOUNT_ACTIVATION_DAYS = 14
ACCOUNT_ACTIVATION_DAYS = 0
ADMINS = (('Nick Sergeant', 'nick@snipt.net'),)
ALLOWED_HOSTS = ['*']
AUTH_PROFILE_MODULE = 'accounts.UserProfile'
View
34 urls.py
@@ -6,7 +6,6 @@
from django.http import HttpResponseRedirect
from django.views.generic import RedirectView, TemplateView
from django.views.static import serve
from forms import AuthenticationFormWithInactiveUsersOkay
from snipts.api import (PublicSniptResource,
PublicUserResource, PrivateSniptResource,
PrivateFavoriteResource, PrivateUserProfileResource,
@@ -33,49 +32,32 @@
if os.environ.get("DISABLE_SIGNUP") != "true":
urlpatterns += [
url(r'^register/$', lambda x: HttpResponseRedirect('/signup/')),
url(r'^signup/$', SniptRegistrationView.as_view(),
name='registration_register'),
url(r'^signup/$', SniptRegistrationView.as_view(), name='registration_register'),
url(r'', include('registration.backends.simple.urls')),
]
urlpatterns += [
url(r'^$', homepage),
url(r'^login-redirect/$', login_redirect),
url(r'^admin/', include(admin.site.urls)),
url(r'^404/$', TemplateView.as_view(template_name='404.html')),
url(r'^500/$', TemplateView.as_view(template_name='500.html')),
url(r'^robots.txt$',
TemplateView.as_view(template_name='robots.txt')),
url(r'^robots.txt$', TemplateView.as_view(template_name='robots.txt')),
url(r'^tags/$', tags),
url(r'^account/', include('accounts.urls')),
url(r'^api/public/lexer/$', lexers),
url(r'^api/private/key/$', user_api_key),
url(r'^api/', include(public_api.urls)),
url(r'^api/', include(private_api.urls)),
url(r'^search/$', search),
url(r'^activate/complete/$', RedirectView.as_view(
url='/login-redirect/')),
url(r'^login/?$', login, {
'authentication_form': AuthenticationFormWithInactiveUsersOkay
}, name='login'),
url(r'', include('registration.backends.default.urls')),
url(r'^activate/complete/$', RedirectView.as_view( url='/login-redirect/')),
url(r'^login/?$', login, name='login'),
url(r'^', include('teams.urls')),
url(r'^', include('snipts.urls')),
url(r'^(?P<path>favicon\.ico)$', serve, {
'document_root': os.path.join(os.path.dirname(__file__),
'static/img')
}),
'document_root': os.path.join(os.path.dirname(__file__), 'static/img')
}),
url(r'^static/(?P<path>.*)$', serve, {
'document_root': os.path.join(os.path.dirname(__file__),
'media')
'document_root': os.path.join(os.path.dirname(__file__), 'media')
})
]
View
@@ -1,4 +1,4 @@
from registration.backends.default.views import RegistrationView
from registration.backends.simple.views import RegistrationView
from utils.forms import SniptRegistrationForm
@@ -12,4 +12,4 @@ def dispatch(self, request, *args, **kwargs):
return super(RegistrationView, self).dispatch(request, *args, **kwargs)
def get_success_url(self, request):
return '/account/activate/'
return '/login-redirect'

0 comments on commit ffe433e

Please sign in to comment.