Back to Snipt

master
Nick Sergeant 2019-04-24 09:13:47 -04:00
parent 6ea91c3b0e
commit 650e35b820
6 changed files with 28 additions and 28 deletions

View File

@ -64,7 +64,7 @@ deploy:
git push dokku
run:
~/.virtualenvs/snippets/bin/python manage.py runserver
~/.virtualenvs/snipt/bin/python manage.py runserver
sass:
sass media/css/style.scss > media/css/style.css

View File

@ -3,30 +3,30 @@
## Running locally
- Clone the repo.
- `cd snippets`
- `python3 -m venv ~/.virtualenvs/snippets`
- `source ~/.virtualenvs/snippets/bin/activate`
- `cd snipt`
- `python3 -m venv ~/.virtualenvs/snipt`
- `source ~/.virtualenvs/snipt/bin/activate`
- `pip install -r requirements.txt`
- `brew install postgresql`
- `brew services start postgresql`
- `createuser snippets`
- `createdb snippets --owner=snippets`
- `createuser snipt`
- `createdb snipt --owner=snipt`
- `cp settings_local.py-template settings_local.py` // modify if necessary
- `curl -X PUT "localhost:9200/haystack?pretty"`
- `python manage.py update_index` // optional if you have a local DB dump with snippets
- `python manage.py update_index` // optional if you have a local DB dump with snipt
- `make run`
## Deploying on Dokku
- `dokku apps:create snippets`
- `dokku postgres:create snippets`
- `dokku postgres:link snippets snippets`
- `dokku apps:create snipt`
- `dokku postgres:create snipt`
- `dokku postgres:link snipt snipt`
- `scp snipt.dump nsergeant@server.nicksergeant.com:/home/nsergeant`
- `dokku postgres:connect snippets < snipt.dump`
- `dokku domains:add snippets snippets.siftie.com`
- `dokku storage:mount snippets /var/lib/dokku/data/storage/snippets-whoosh:/app/snippets-whoosh`
- `dokku config:set DOKKU_LETSENCRYPT_EMAIL=team@siftie.com SECRET_KEY=<some-secret-key> USE_SSL=true WHOOSH_PATH=/app/snippets-whoosh/whoosh_index`
- `git remote add dokku dokku@server.nicksergeant.com:snippets`
- `dokku postgres:connect snipt < snipt.dump`
- `dokku domains:add snipt snipt.net`
- `dokku storage:mount snipt /var/lib/dokku/data/storage/snipt-whoosh:/app/snipt-whoosh`
- `dokku config:set DOKKU_LETSENCRYPT_EMAIL=support@snipt.net SECRET_KEY=<some-secret-key> USE_SSL=true WHOOSH_PATH=/app/snipt-whoosh/whoosh_index`
- `git remote add dokku dokku@server.nicksergeant.com:snipt`
- `git push dokku`
## Automatic deploy to Heroku

View File

@ -9,8 +9,8 @@ USE_HTTPS = False
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'snippets',
'USER': 'snippets',
'NAME': 'snipt',
'USER': 'snipt',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': ''

View File

@ -398,12 +398,12 @@ def report_spam(request, snipt_id):
send_mail('[Snipt] Spam reported',
"""
Snipt: https://snippets.siftie.com/admin/snipts/snipt/{}/
User: https://snippets.siftie.com/admin/auth/user/{}/delete/
User who reported: https://snippets.siftie.com/admin/auth/user/{}/
Snipt: https://snipt.net/admin/snipts/snipt/{}/
User: https://snipt.net/admin/auth/user/{}/delete/
User who reported: https://snipt.net/admin/auth/user/{}/
""".format(snipt.id, snipt.user.id, request.user.id),
'team@siftie.com',
['nick@siftie.com'],
'support@snipt.net',
['support@snipt.net'],
fail_silently=False)
return HttpResponse("""Thanks! Your report has been

View File

@ -24,9 +24,9 @@
Snipt for Teams
<ul class="features">
<li>Team profile at snipt.net/{team-name}.</li>
<li>Members can create and edit public and private snippets on a team.</li>
<li>Members can create and edit public and private snipts on a team.</li>
<li>Detailed log of changes on a snippet, including user and code diffs.</li>
<li>Maintain a public team profile by posting public snippets.</li>
<li>Maintain a public team profile by posting public snipts.</li>
</ul>
</div>
{% if not request.user.is_authenticated %}

View File

@ -78,7 +78,7 @@
<!-- <div class="fields"> -->
<!-- <input ng-model="search.query" type="text" class="search-query" name="q" -->
<!-- ng-init="search.query='{{ query|escapejs }}'" -->
<!-- placeholder="Search snippets" id="id_q" -->
<!-- placeholder="Search snipts" id="id_q" -->
<!-- value="{{ query }}" /> -->
<!-- </div> -->
<!-- </fieldset> -->
@ -87,7 +87,7 @@
<ul>
{% if not request.user.is_authenticated %}
<li>
<a href="/public/" {% if '/public/' in request.path or public %} class="active"{% endif %}>Public snippets</a>
<a href="/public/" {% if '/public/' in request.path or public %} class="active"{% endif %}>Public snipts</a>
</li>
<li>
<a href="/login/?next={{ request.path }}" {% if '/login/' in request.path %} class="active"{% endif %}>Log in</a>
@ -99,10 +99,10 @@
{% endif %}
{% else %}
<li>
<a href="/{{ request.user.username }}/" {% if request.user.username in request.path %} class="active"{% endif %}>My snippets</a>
<a href="/{{ request.user.username }}/" {% if request.user.username in request.path %} class="active"{% endif %}>My snipts</a>
</li>
<li>
<a href="/public/" {% if '/public/' in request.path or public %} class="active"{% endif %}>Public snippets</a>
<a href="/public/" {% if '/public/' in request.path or public %} class="active"{% endif %}>Public snipts</a>
</li>
{% block add-snipt %}{% endblock %}
{% endif %}