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 git push dokku
run: run:
~/.virtualenvs/snippets/bin/python manage.py runserver ~/.virtualenvs/snipt/bin/python manage.py runserver
sass: sass:
sass media/css/style.scss > media/css/style.css sass media/css/style.scss > media/css/style.css

View File

@ -3,30 +3,30 @@
## Running locally ## Running locally
- Clone the repo. - Clone the repo.
- `cd snippets` - `cd snipt`
- `python3 -m venv ~/.virtualenvs/snippets` - `python3 -m venv ~/.virtualenvs/snipt`
- `source ~/.virtualenvs/snippets/bin/activate` - `source ~/.virtualenvs/snipt/bin/activate`
- `pip install -r requirements.txt` - `pip install -r requirements.txt`
- `brew install postgresql` - `brew install postgresql`
- `brew services start postgresql` - `brew services start postgresql`
- `createuser snippets` - `createuser snipt`
- `createdb snippets --owner=snippets` - `createdb snipt --owner=snipt`
- `cp settings_local.py-template settings_local.py` // modify if necessary - `cp settings_local.py-template settings_local.py` // modify if necessary
- `curl -X PUT "localhost:9200/haystack?pretty"` - `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` - `make run`
## Deploying on Dokku ## Deploying on Dokku
- `dokku apps:create snippets` - `dokku apps:create snipt`
- `dokku postgres:create snippets` - `dokku postgres:create snipt`
- `dokku postgres:link snippets snippets` - `dokku postgres:link snipt snipt`
- `scp snipt.dump nsergeant@server.nicksergeant.com:/home/nsergeant` - `scp snipt.dump nsergeant@server.nicksergeant.com:/home/nsergeant`
- `dokku postgres:connect snippets < snipt.dump` - `dokku postgres:connect snipt < snipt.dump`
- `dokku domains:add snippets snippets.siftie.com` - `dokku domains:add snipt snipt.net`
- `dokku storage:mount snippets /var/lib/dokku/data/storage/snippets-whoosh:/app/snippets-whoosh` - `dokku storage:mount snipt /var/lib/dokku/data/storage/snipt-whoosh:/app/snipt-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` - `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:snippets` - `git remote add dokku dokku@server.nicksergeant.com:snipt`
- `git push dokku` - `git push dokku`
## Automatic deploy to Heroku ## Automatic deploy to Heroku

View File

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

View File

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

View File

@ -24,9 +24,9 @@
Snipt for Teams Snipt for Teams
<ul class="features"> <ul class="features">
<li>Team profile at snipt.net/{team-name}.</li> <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>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> </ul>
</div> </div>
{% if not request.user.is_authenticated %} {% if not request.user.is_authenticated %}

View File

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