Skip to content
Permalink
Browse files

Back to Snipt

  • Loading branch information
nicksergeant committed Apr 24, 2019
1 parent 6ea91c3 commit 650e35b82034c351cb2b50736a5fbc29ec92d3d6
Showing with 28 additions and 28 deletions.
  1. +1 βˆ’1 Makefile
  2. +14 βˆ’14 README.md
  3. +2 βˆ’2 settings_local.py-template
  4. +5 βˆ’5 snipts/views.py
  5. +2 βˆ’2 teams/templates/teams/for-teams.html
  6. +4 βˆ’4 templates/base.html
@@ -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
@@ -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
@@ -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': ''
@@ -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
@@ -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 %}
@@ -78,7 +78,7 @@ <h1 class="main-logo"><a href="{% if request.user.is_authenticated %}/{{ request
<!-- <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 @@ <h1 class="main-logo"><a href="{% if request.user.is_authenticated %}/{{ request
<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 @@ <h1 class="main-logo"><a href="{% if request.user.is_authenticated %}/{{ request
{% 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 %}

0 comments on commit 650e35b

Please sign in to comment.
You can’t perform that action at this time.