Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
9d9d7b37
Commit
9d9d7b37
authored
Nov 22, 2017
by
sim
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'simon-backend-app' into simon-gargantext-light
parents
5eb6a180
f30f19bb
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
213 additions
and
8 deletions
+213
-8
__init__.py
gargantext/__init__.py
+0
-1
__init__.py
gargantext/backend/__init__.py
+1
-0
celery_app.py
gargantext/backend/celery_app.py
+0
-0
jwt.py
gargantext/backend/jwt.py
+1
-1
__init__.py
gargantext/backend/management/__init__.py
+0
-0
__init__.py
gargantext/backend/management/commands/__init__.py
+0
-0
nodes.py
gargantext/backend/management/commands/nodes.py
+1
-1
settings.py
gargantext/backend/settings.py
+207
-0
urls.py
gargantext/backend/urls.py
+2
-0
wsgi.py
gargantext/backend/wsgi.py
+0
-0
gargantext.template.ini
tools/conf/gargantext.template.ini
+1
-1
mkenvs.sh
tools/mkenvs.sh
+0
-4
No files found.
gargantext/__init__.py
View file @
9d9d7b37
from
.celery_app
import
app
as
celery_app
gargantext/backend/__init__.py
0 → 100644
View file @
9d9d7b37
from
.celery_app
import
app
as
celery_app
gargantext/celery_app.py
→
gargantext/
backend/
celery_app.py
View file @
9d9d7b37
File moved
gargantext/
util
/jwt.py
→
gargantext/
backend
/jwt.py
View file @
9d9d7b37
...
...
@@ -2,7 +2,7 @@ from django.conf import settings
from
rest_framework_jwt.settings
import
api_settings
from
calendar
import
timegm
from
.dates
import
datetime
from
gargantext.util
.dates
import
datetime
def
jwt_payload_handler
(
user
):
username
=
user
.
username
...
...
gargantext/management/__init__.py
→
gargantext/
backend/
management/__init__.py
View file @
9d9d7b37
File moved
gargantext/management/commands/__init__.py
→
gargantext/
backend/
management/commands/__init__.py
View file @
9d9d7b37
File moved
gargantext/management/commands/nodes.py
→
gargantext/
backend/
management/commands/nodes.py
View file @
9d9d7b37
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
from
gargantext.util.show_nodes
import
tree_show
,
nodes
import
colorama
...
...
gargantext/backend/settings.py
0 → 100644
View file @
9d9d7b37
"""
Django settings for gargantext project.
Generated by 'django-admin startproject' using Django 1.11.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import
os
from
gargantext.util.config
import
config
import
datetime
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY
=
config
(
'SECRET_KEY'
)
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG
=
config
(
'DEBUG'
,
default
=
False
,
cast
=
bool
)
MAINTENANCE
=
config
(
'MAINTENANCE'
,
default
=
False
,
cast
=
bool
)
ALLOWED_HOSTS
=
config
(
'ALLOWED_HOSTS'
,
default
=
''
,
cast
=
lambda
v
:
list
(
filter
(
None
,
v
.
split
(
' '
))))
# Application definition
INSTALLED_APPS
=
[
'django.contrib.admin'
,
'django.contrib.auth'
,
'django.contrib.contenttypes'
,
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'rest_framework'
,
'djcelery'
,
'gargantext.backend'
,
]
MIDDLEWARE
=
[
'django.middleware.security.SecurityMiddleware'
,
'django.contrib.sessions.middleware.SessionMiddleware'
,
'django.middleware.common.CommonMiddleware'
,
'django.middleware.csrf.CsrfViewMiddleware'
,
'django.contrib.auth.middleware.AuthenticationMiddleware'
,
'django.contrib.messages.middleware.MessageMiddleware'
,
'django.middleware.clickjacking.XFrameOptionsMiddleware'
,
]
ROOT_URLCONF
=
'gargantext.backend.urls'
TEMPLATES
=
[
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[],
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'context_processors'
:
[
'django.template.context_processors.debug'
,
'django.template.context_processors.request'
,
'django.contrib.auth.context_processors.auth'
,
'django.contrib.messages.context_processors.messages'
,
],
},
},
]
WSGI_APPLICATION
=
'gargantext.backend.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.postgresql_psycopg2'
,
'NAME'
:
config
(
'DB_NAME'
,
default
=
'gargandb'
),
'USER'
:
config
(
'DB_USER'
,
default
=
'gargantua'
),
'PASSWORD'
:
config
(
'DB_PASS'
),
'HOST'
:
config
(
'DB_HOST'
,
default
=
'127.0.0.1'
),
'PORT'
:
config
(
'DB_PORT'
,
default
=
'5432'
),
'TEST'
:
{
'NAME'
:
'test_gargandb'
,
},
}
}
DATABASES
[
'default'
][
'URL'
]
=
\
'postgresql+psycopg2://{USER}:{PASSWORD}@{HOST}:{PORT}/{NAME}'
.
format
(
**
DATABASES
[
'default'
]
)
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS
=
[
{
'NAME'
:
'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'
,
},
{
'NAME'
:
'django.contrib.auth.password_validation.MinimumLengthValidator'
,
},
{
'NAME'
:
'django.contrib.auth.password_validation.CommonPasswordValidator'
,
},
{
'NAME'
:
'django.contrib.auth.password_validation.NumericPasswordValidator'
,
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE
=
'en-us'
TIME_ZONE
=
'UTC'
USE_I18N
=
True
USE_L10N
=
True
USE_TZ
=
True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_ROOT
=
os
.
path
.
join
(
BASE_DIR
,
'static'
)
STATIC_URL
=
'/static/'
STATICFILES_DIRS
=
(
os
.
path
.
join
(
BASE_DIR
,
'gargantext/static'
),
)
STATICFILES_FINDERS
=
(
'django.contrib.staticfiles.finders.AppDirectoriesFinder'
,
'django.contrib.staticfiles.finders.FileSystemFinder'
,
)
MEDIA_ROOT
=
os
.
path
.
join
(
BASE_DIR
,
'media'
)
MEDIA_URL
=
'/media/'
# Asynchronous tasks
import
djcelery
djcelery
.
setup_loader
()
BROKER_URL
=
'amqp://guest:guest@localhost:5672/'
CELERY_ACCEPT_CONTENT
=
[
'pickle'
,
'json'
,
'msgpack'
,
'yaml'
]
CELERY_TIMEZONE
=
'Europe/Paris'
CELERYBEAT_SCHEDULER
=
'djcelery.schedulers.DatabaseScheduler'
CELERY_IMPORTS
=
(
"gargantext.util.toolchain"
,
"gargantext.util.crawlers"
,
"gargantext.util.ngramlists_tools"
,
)
# REST-API
# See http://getblimp.github.io/django-rest-framework-jwt/#additional-settings
REST_FRAMEWORK
=
{
'DEFAULT_PERMISSION_CLASSES'
:
(
'rest_framework.permissions.IsAuthenticated'
,
),
'DEFAULT_AUTHENTICATION_CLASSES'
:
(
'rest_framework_jwt.authentication.JSONWebTokenAuthentication'
,
'rest_framework.authentication.SessionAuthentication'
,
'rest_framework.authentication.BasicAuthentication'
,
),
}
# See http://getblimp.github.io/django-rest-framework-jwt/
JWT_AUTH
=
{
'JWT_PAYLOAD_HANDLER'
:
'gargantext.backend.jwt.jwt_payload_handler'
,
'JWT_VERIFY_EXPIRATION'
:
True
,
'JWT_SECRET_KEY'
:
config
(
'SECRET_KEY'
),
'JWT_EXPIRATION_DELTA'
:
datetime
.
timedelta
(
seconds
=
36000
),
'JWT_AUTH_HEADER_PREFIX'
:
'Bearer'
,
}
ROLE_SUPERUSER
=
'gargantua'
ROLE_STAFF
=
'gargandmin'
ROLE_USER
=
'gargantext'
# Third-party web APIs
API_TOKENS
=
{
"CERN"
:
{
"APIKEY"
:
'b8514451-82d1-408e-a855-56d342a0b5f8'
,
"APISECRET"
:
'6680b13e-2b5a-4fba-8c0e-408884d5b904'
,
},
"MULTIVAC"
:
{
"APIKEY"
:
"3a8ca010-1dff-11e7-97ef-a1a6aa4c2352"
}
}
# BOOL Interpreter
BOOL_TOOLS_PATH
=
"gargantext/util/crawlers/sparql"
gargantext/urls.py
→
gargantext/
backend/
urls.py
View file @
9d9d7b37
...
...
@@ -17,9 +17,11 @@ from django.conf.urls import url
from
django.contrib
import
admin
from
django.views.generic.base
import
RedirectView
as
Redirect
from
django.contrib.staticfiles.storage
import
staticfiles_storage
as
static
from
rest_framework_jwt.views
import
obtain_jwt_token
urlpatterns
=
[
url
(
r'^admin/'
,
admin
.
site
.
urls
),
url
(
r'^favicon.ico$'
,
Redirect
.
as_view
(
url
=
static
.
url
(
'favicon.ico'
),
permanent
=
False
),
name
=
"favicon"
),
url
(
r'^api/auth/token$'
,
obtain_jwt_token
),
]
gargantext/wsgi.py
→
gargantext/
backend/
wsgi.py
View file @
9d9d7b37
File moved
tools/conf/gargantext.template.ini
View file @
9d9d7b37
...
...
@@ -33,7 +33,7 @@ chmod-socket = 664
# user running uwsgi MUST be a member of www-data group
chown-socket
=
%U:www-data
# wsgi django module
module
=
gargantext.wsgi:application
module
=
gargantext.
backend.
wsgi:application
# about master: http://uwsgi-docs.readthedocs.io/en/latest/Management.html?highlight=master#reloading-the-server
master
=
True
# can do: uwsgi --stop /tmp/gargantext.pid
...
...
tools/mkenvs.sh
View file @
9d9d7b37
#!/usr/bin/env bash
ENV_FILE
=
.env
<<<<<<
< Updated upstream
DSM
=
gargantext.settings
=======
DSM
=
gargantext.backend.settings
GARGANTEXT_CONF
=
${
GARGANTEXT_CONF
:-
gargantext
.ini
}
POSTGREST_CONF
=
${
POSTGREST_CONF
:-
postgrest
.conf
}
>>>>>>>
Stashed changes
read
-r
-d
''
DJANGO_VAR
<<
EOF
# Django settings module, it is unlikely that you'll need to change that.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment