Remove requirement on Postmark for basic installs.
parent
fbb01102ae
commit
ffe433e734
27
README.md
27
README.md
|
@ -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)
|
[![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
|
## Manual deploy to Heroku
|
||||||
|
|
||||||
- Clone the repo.
|
- Clone the repo.
|
||||||
- `heroku create`
|
- `heroku create`
|
||||||
- `heroku addons:add heroku-postgresql:hobby-dev`
|
- `heroku addons:add heroku-postgresql:hobby-dev`
|
||||||
- `heroku addons:add searchbox`
|
- `heroku addons:add searchbox`
|
||||||
- `heroku addons:create postmark:10k`
|
- `heroku config:add SECRET_KEY=<some-secret-key>`
|
||||||
- `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=`
|
|
||||||
- `git push heroku`
|
- `git push heroku`
|
||||||
- `heroku run python manage.py migrate`
|
- `heroku run python manage.py migrate`
|
||||||
- `heroku run python manage.py createsuperuser`
|
- `heroku run python manage.py createsuperuser`
|
||||||
|
@ -47,6 +28,12 @@ the following after deploying (you'll need the
|
||||||
|
|
||||||
## Options
|
## 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:
|
If you want to disable user-facing signup:
|
||||||
|
|
||||||
- `heroku config:set DISABLE_SIGNUP=true`
|
- `heroku config:set DISABLE_SIGNUP=true`
|
||||||
|
|
6
forms.py
6
forms.py
|
@ -1,6 +0,0 @@
|
||||||
from django.contrib.auth.forms import AuthenticationForm
|
|
||||||
|
|
||||||
|
|
||||||
class AuthenticationFormWithInactiveUsersOkay(AuthenticationForm):
|
|
||||||
def confirm_login_allowed(self, user):
|
|
||||||
pass
|
|
|
@ -42,7 +42,7 @@ if 'HAYSTACK_URL' in os.environ:
|
||||||
|
|
||||||
|
|
||||||
ABSOLUTE_URL_OVERRIDES = {'auth.user': lambda u: "/%s/" % u.username}
|
ABSOLUTE_URL_OVERRIDES = {'auth.user': lambda u: "/%s/" % u.username}
|
||||||
ACCOUNT_ACTIVATION_DAYS = 14
|
ACCOUNT_ACTIVATION_DAYS = 0
|
||||||
ADMINS = (('Nick Sergeant', 'nick@snipt.net'),)
|
ADMINS = (('Nick Sergeant', 'nick@snipt.net'),)
|
||||||
ALLOWED_HOSTS = ['*']
|
ALLOWED_HOSTS = ['*']
|
||||||
AUTH_PROFILE_MODULE = 'accounts.UserProfile'
|
AUTH_PROFILE_MODULE = 'accounts.UserProfile'
|
||||||
|
|
32
urls.py
32
urls.py
|
@ -6,7 +6,6 @@ from django.contrib.auth.views import login
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.views.generic import RedirectView, TemplateView
|
from django.views.generic import RedirectView, TemplateView
|
||||||
from django.views.static import serve
|
from django.views.static import serve
|
||||||
from forms import AuthenticationFormWithInactiveUsersOkay
|
|
||||||
from snipts.api import (PublicSniptResource,
|
from snipts.api import (PublicSniptResource,
|
||||||
PublicUserResource, PrivateSniptResource,
|
PublicUserResource, PrivateSniptResource,
|
||||||
PrivateFavoriteResource, PrivateUserProfileResource,
|
PrivateFavoriteResource, PrivateUserProfileResource,
|
||||||
|
@ -33,49 +32,32 @@ urlpatterns = []
|
||||||
if os.environ.get("DISABLE_SIGNUP") != "true":
|
if os.environ.get("DISABLE_SIGNUP") != "true":
|
||||||
urlpatterns += [
|
urlpatterns += [
|
||||||
url(r'^register/$', lambda x: HttpResponseRedirect('/signup/')),
|
url(r'^register/$', lambda x: HttpResponseRedirect('/signup/')),
|
||||||
url(r'^signup/$', SniptRegistrationView.as_view(),
|
url(r'^signup/$', SniptRegistrationView.as_view(), name='registration_register'),
|
||||||
name='registration_register'),
|
url(r'', include('registration.backends.simple.urls')),
|
||||||
]
|
]
|
||||||
|
|
||||||
urlpatterns += [
|
urlpatterns += [
|
||||||
url(r'^$', homepage),
|
url(r'^$', homepage),
|
||||||
url(r'^login-redirect/$', login_redirect),
|
url(r'^login-redirect/$', login_redirect),
|
||||||
|
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
|
|
||||||
url(r'^404/$', TemplateView.as_view(template_name='404.html')),
|
url(r'^404/$', TemplateView.as_view(template_name='404.html')),
|
||||||
url(r'^500/$', TemplateView.as_view(template_name='500.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'^tags/$', tags),
|
||||||
|
|
||||||
url(r'^account/', include('accounts.urls')),
|
url(r'^account/', include('accounts.urls')),
|
||||||
|
|
||||||
url(r'^api/public/lexer/$', lexers),
|
url(r'^api/public/lexer/$', lexers),
|
||||||
|
|
||||||
url(r'^api/private/key/$', user_api_key),
|
url(r'^api/private/key/$', user_api_key),
|
||||||
url(r'^api/', include(public_api.urls)),
|
url(r'^api/', include(public_api.urls)),
|
||||||
url(r'^api/', include(private_api.urls)),
|
url(r'^api/', include(private_api.urls)),
|
||||||
|
|
||||||
url(r'^search/$', search),
|
url(r'^search/$', search),
|
||||||
|
url(r'^activate/complete/$', RedirectView.as_view( url='/login-redirect/')),
|
||||||
url(r'^activate/complete/$', RedirectView.as_view(
|
url(r'^login/?$', login, name='login'),
|
||||||
url='/login-redirect/')),
|
|
||||||
url(r'^login/?$', login, {
|
|
||||||
'authentication_form': AuthenticationFormWithInactiveUsersOkay
|
|
||||||
}, name='login'),
|
|
||||||
url(r'', include('registration.backends.default.urls')),
|
|
||||||
|
|
||||||
url(r'^', include('teams.urls')),
|
url(r'^', include('teams.urls')),
|
||||||
url(r'^', include('snipts.urls')),
|
url(r'^', include('snipts.urls')),
|
||||||
|
|
||||||
url(r'^(?P<path>favicon\.ico)$', serve, {
|
url(r'^(?P<path>favicon\.ico)$', serve, {
|
||||||
'document_root': os.path.join(os.path.dirname(__file__),
|
'document_root': os.path.join(os.path.dirname(__file__), 'static/img')
|
||||||
'static/img')
|
|
||||||
}),
|
}),
|
||||||
url(r'^static/(?P<path>.*)$', serve, {
|
url(r'^static/(?P<path>.*)$', serve, {
|
||||||
'document_root': os.path.join(os.path.dirname(__file__),
|
'document_root': os.path.join(os.path.dirname(__file__), 'media')
|
||||||
'media')
|
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from registration.backends.default.views import RegistrationView
|
from registration.backends.simple.views import RegistrationView
|
||||||
from utils.forms import SniptRegistrationForm
|
from utils.forms import SniptRegistrationForm
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,4 +12,4 @@ class SniptRegistrationView(RegistrationView):
|
||||||
return super(RegistrationView, self).dispatch(request, *args, **kwargs)
|
return super(RegistrationView, self).dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
def get_success_url(self, request):
|
def get_success_url(self, request):
|
||||||
return '/account/activate/'
|
return '/login-redirect'
|
||||||
|
|
Loading…
Reference in New Issue