Some initial work on gutting es

master
Nick Sergeant 2019-01-23 18:51:49 -05:00
父节点 0f8556a80a
当前提交 6af387be82
共有 5 个文件被更改,包括 3 次插入41 次删除

1
.gitignore vendored
查看文件

@ -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 @@ from urllib.parse import urlparse
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',
},
}