Skip to content
Permalink
Browse files

Some initial work on gutting es

  • Loading branch information
nicksergeant committed Jan 23, 2019
1 parent 0f8556a commit 6af387be8228093e0b6c6b10fb734193d375ff91
Showing with 3 additions and 41 deletions.
  1. +1 βˆ’0 .gitignore
  2. +0 βˆ’3 README.md
  3. +2 βˆ’1 requirements.txt
  4. +0 βˆ’30 settings.py
  5. +0 βˆ’7 settings_local.py-template
@@ -2,6 +2,7 @@
.sass-cache
.vagrant
.venv
.whoosh_index

*.log
*.un~
@@ -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`
@@ -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

@@ -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
@@ -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
@@ -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'),)
@@ -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.
You can’t perform that action at this time.