Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Some initial work on gutting es
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksergeant committed Jan 23, 2019
1 parent 0f8556a commit 6af387b
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,6 +2,7 @@
.sass-cache
.vagrant
.venv
.whoosh_index

*.log
*.un~
Expand Down
3 changes: 0 additions & 3 deletions README.md
Expand Up @@ -12,8 +12,6 @@
- `createuser snippets`
- `createdb snippets --owner=snippets`
- `cp settings_local.py-template settings_local.py` // modify if necessary
- `brew install elasticsearch`
- `brew services start elasticsearch`
- `curl -X PUT "localhost:9200/haystack?pretty"`
- `python manage.py update_index` // optional if you have a local DB dump with snippets
- `make run`
Expand All @@ -29,7 +27,6 @@
- `dokku config:set DOKKU_LETSENCRYPT_EMAIL=team@siftie.com SECRET_KEY=<some-secret-key> USE_SSL=true`
- `git remote add dokku dokku@server.nicksergeant.com:snippets`
- `git push dokku`
- Elasticsearch 2.x only!

## Automatic deploy to Heroku

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Expand Up @@ -2,6 +2,8 @@ Django==1.11.18
Fabric==1.12.0
PyYAML==3.13
Pygments==2.1.3
Whoosh==2.7.4
black==18.9b0
certifi==2016.9.26
dj-database-url==0.4.1
dj-static==0.0.6
Expand All @@ -15,7 +17,6 @@ django-registration-redux==1.4
django-storages==1.5.1
django-taggit==0.21.3
django-tastypie==0.14
elasticsearch>=2.0.0,<3.0.0
git+git://github.com/matagus/django-pagination-py3.git#egg=django-pagination
git+git://github.com/nicksergeant/django-templatetag-sugar.git#egg=django-templatetag-sugar
gunicorn==19.6.0
Expand Down
30 changes: 0 additions & 30 deletions settings.py
Expand Up @@ -3,39 +3,9 @@
import dj_database_url
import os


if 'DATABASE_URL' in os.environ:

DATABASES = {'default': dj_database_url.config()}

if 'SEARCHBOX_SSL_URL' in os.environ:

url = os.environ.get('SEARCHBOX_SSL_URL')

es = urlparse(url)

HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': es.scheme + '://' + es.hostname + ':443',
'INDEX_NAME': 'snipts',
},
}

if es.username:
HAYSTACK_CONNECTIONS['default']['KWARGS'] = {
"http_auth": es.username + ':' + es.password
}

else:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine'
}
}



ABSOLUTE_URL_OVERRIDES = {'auth.user': lambda u: "/%s/" % u.username}
ACCOUNT_ACTIVATION_DAYS = 0
ADMINS = (('Siftie', 'team@siftie.com'),)
Expand Down
7 changes: 0 additions & 7 deletions settings_local.py-template
Expand Up @@ -16,10 +16,3 @@ DATABASES = {
'PORT': ''
}
}
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
},
}

0 comments on commit 6af387b

Please sign in to comment.