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
24cd6f49
Commit
24cd6f49
authored
Nov 02, 2017
by
sim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Django settings import
parent
b8d171bd
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
50 additions
and
55 deletions
+50
-55
env.py
alembic/env.py
+2
-1
constants.py
gargantext/constants.py
+2
-2
CERN.py
gargantext/util/crawlers/CERN.py
+4
-4
MULTIVAC.py
gargantext/util/crawlers/MULTIVAC.py
+18
-18
PUBMED.py
gargantext/util/crawlers/PUBMED.py
+0
-1
__init__.py
gargantext/util/crawlers/__init__.py
+3
-3
bool2sparql.py
gargantext/util/crawlers/sparql/bool2sparql.py
+8
-9
dates.py
gargantext/util/dates.py
+0
-3
db.py
gargantext/util/db.py
+1
-1
http.py
gargantext/util/http.py
+1
-1
__init__.py
gargantext/util/parsers/__init__.py
+3
-3
scheduling.py
gargantext/util/scheduling.py
+2
-2
mail_notification.py
gargantext/util/toolchain/mail_notification.py
+2
-2
main.py
gargantext/util/toolchain/main.py
+3
-3
ngram_coocs.py
gargantext/util/toolchain/ngram_coocs.py
+1
-2
No files found.
alembic/env.py
View file @
24cd6f49
...
...
@@ -13,7 +13,8 @@ django.setup()
# ...to be able to import gargantext.
from
gargantext
import
settings
,
models
from
django.conf
import
settings
from
gargantext
import
models
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
...
...
gargantext/constants.py
View file @
24cd6f49
...
...
@@ -37,7 +37,7 @@ import re
import
importlib
from
gargantext.util.lists
import
*
from
gargantext.util
import
datetime
,
convert_to_datetime
from
.settings
import
BASE_DIR
from
django.conf
import
settings
# types & models (nodes, lists, hyperdata, resource) ---------------------------------------------
LISTTYPES
=
{
...
...
@@ -398,7 +398,7 @@ DEFAULT_CSV_DELIM_GROUP = '|&|'
# Files ----------------------------------------------------------------
# uploads/.gitignore prevents corpora indexing
# copora can be either a folder or symlink towards specific partition
UPLOAD_DIRECTORY
=
os
.
path
.
join
(
BASE_DIR
,
'uploads/corpora'
)
UPLOAD_DIRECTORY
=
os
.
path
.
join
(
settings
.
BASE_DIR
,
'uploads/corpora'
)
UPLOAD_LIMIT
=
1024
*
1024
*
1024
DOWNLOAD_DIRECTORY
=
UPLOAD_DIRECTORY
...
...
gargantext/util/crawlers/CERN.py
View file @
24cd6f49
...
...
@@ -12,7 +12,7 @@ import random
import
urllib.parse
as
uparse
from
lxml
import
etree
from
gargantext.settings
import
API_TOKENS
from
django.conf
import
settings
from
._Crawler
import
Crawler
from
gargantext.util.timeit_damnit
import
timing
...
...
@@ -21,7 +21,7 @@ from gargantext.util.timeit_damnit import timing
class
CernCrawler
(
Crawler
):
'''CERN SCOAP3 API Interaction'''
def
__init__
(
self
):
API
=
API_TOKENS
[
"CERN"
]
API
=
settings
.
API_TOKENS
[
"CERN"
]
self
.
apikey
=
API
[
"APIKEY"
]
.
encode
(
"utf-8"
)
self
.
secret
=
bytearray
(
API
[
"APISECRET"
]
.
encode
(
"utf-8"
))
self
.
BASE_URL
=
u"http://api.scoap3.org/search?"
...
...
gargantext/util/crawlers/MULTIVAC.py
View file @
24cd6f49
...
...
@@ -8,7 +8,7 @@
from
._Crawler
import
*
import
json
from
gargantext.settings
import
API_TOKENS
from
django.conf
import
settings
from
gargantext.constants
import
UPLOAD_DIRECTORY
from
math
import
trunc
from
gargantext.util.files
import
save
...
...
@@ -17,7 +17,7 @@ class MultivacCrawler(Crawler):
''' Multivac API CLIENT'''
def
__init__
(
self
):
self
.
apikey
=
API_TOKENS
[
"MULTIVAC"
]
self
.
apikey
=
settings
.
API_TOKENS
[
"MULTIVAC"
]
# Main EndPoints
self
.
BASE_URL
=
"https://api.iscpif.fr/v2"
...
...
@@ -37,7 +37,7 @@ class MultivacCrawler(Crawler):
querystring
=
{
"q"
:
query
,
"count"
:
count
,
"from"
:
fromPage
,
"api_key"
:
API_TOKENS
[
"MULTIVAC"
][
"APIKEY"
]
,
"api_key"
:
settings
.
API_TOKENS
[
"MULTIVAC"
][
"APIKEY"
]
}
if
lang
is
not
None
:
...
...
gargantext/util/crawlers/PUBMED.py
View file @
24cd6f49
...
...
@@ -13,7 +13,6 @@ import datetime
from
os
import
path
import
threading
from
traceback
import
print_tb
#from gargantext.settings import MEDIA_ROOT, BASE_DIR
from
._Crawler
import
Crawler
import
requests
from
lxml
import
etree
...
...
gargantext/util/crawlers/__init__.py
View file @
24cd6f49
import
importlib
from
django.conf
import
settings
from
gargantext.constants
import
RESOURCETYPES
from
gargantext.settings
import
DEBUG
#if DEBUG: print("Loading available Crawlers")
#if
settings.
DEBUG: print("Loading available Crawlers")
base_parser
=
"gargantext.util.crawlers"
for
resource
in
RESOURCETYPES
:
...
...
@@ -14,7 +14,7 @@ for resource in RESOURCETYPES:
module
=
base_parser
+
".
%
s"
%
(
filename
)
importlib
.
import_module
(
module
)
#if DEBUG: print("\t-", name)
#if
settings.
DEBUG: print("\t-", name)
except
Exception
as
e
:
print
(
"Check constants.py RESOURCETYPES declaration
%
s
\n
CRAWLER
%
s is not available for
%
s"
%
(
str
(
e
),
resource
[
"crawler"
],
resource
[
"name"
]))
...
...
gargantext/util/crawlers/sparql/bool2sparql.py
View file @
24cd6f49
import
subprocess
import
re
from
django.conf
import
settings
from
.sparql
import
Service
from
gargantext.settings
import
BOOL_TOOLS_PATH
#from sparql import Service
def
bool2sparql
(
rawQuery
,
count
=
False
,
offset
=
None
,
limit
=
None
):
"""
...
...
@@ -13,7 +12,7 @@ def bool2sparql(rawQuery, count=False, offset=None, limit=None):
See: https://github.com/delanoe/bool2sparql
"""
query
=
re
.
sub
(
"
\"
"
,
"
\'
"
,
rawQuery
)
bashCommand
=
[
BOOL_TOOLS_PATH
+
"/bool2sparql-exe"
,
"-q"
,
query
]
bashCommand
=
[
settings
.
BOOL_TOOLS_PATH
+
"/bool2sparql-exe"
,
"-q"
,
query
]
if
count
is
True
:
bashCommand
.
append
(
"-c"
)
...
...
gargantext/util/dates.py
View file @
24cd6f49
import
os
from
gargantext.settings
import
MEDIA_ROOT
from
datetime
import
MINYEAR
from
dateutil.parser
import
parse
as
parse_datetime_flexible
from
django.utils.dateparse
import
parse_datetime
...
...
gargantext/util/db.py
View file @
24cd6f49
from
gargantext
import
settings
from
django.conf
import
settings
from
gargantext.util.json
import
json_dumps
...
...
gargantext/util/http.py
View file @
24cd6f49
...
...
@@ -6,7 +6,7 @@ from django import forms
from
urllib.parse
import
quote_plus
as
urlencode
from
gargantext
import
settings
from
django.conf
import
settings
from
sqlalchemy.orm.exc
import
DetachedInstanceError
from
traceback
import
print_tb
...
...
gargantext/util/parsers/__init__.py
View file @
24cd6f49
import
importlib
from
gargantext.constants
import
RESOURCETYPES
from
gargantext.settings
import
DEBUG
if
DEBUG
:
from
django.conf
import
settings
if
settings
.
DEBUG
:
print
(
"Loading available PARSERS:"
)
base_parser
=
"gargantext.util.parsers"
for
resource
in
RESOURCETYPES
:
...
...
@@ -12,6 +12,6 @@ for resource in RESOURCETYPES:
module
=
base_parser
+
".
%
s"
%
(
fname
.
upper
())
#parser module is has shown in constants
parser
=
importlib
.
import_module
(
module
)
if
DEBUG
:
if
settings
.
DEBUG
:
print
(
"
\t
-"
,
resource
[
"parser"
])
getattr
(
parser
,
resource
[
"parser"
])
gargantext/util/scheduling.py
View file @
24cd6f49
...
...
@@ -42,8 +42,8 @@ def scheduled_celery(func):
return
go
from
gargantext.settings
import
DEBUG
if
DEBUG
:
from
django.conf
import
settings
if
settings
.
DEBUG
:
# scheduled = scheduled_now
scheduled
=
scheduled_thread
else
:
...
...
gargantext/util/toolchain/mail_notification.py
View file @
24cd6f49
...
...
@@ -2,7 +2,7 @@
from
gargantext.models.users
import
User
from
gargantext.util.db
import
session
from
django.core.mail
import
send_mail
from
gargantext.settings
import
BASE_URL
from
django.conf
import
settings
...
...
@@ -65,7 +65,7 @@ drafts = {
def
notification
(
corpus
,
draft
,
subject
=
'Update'
):
user
=
session
.
query
(
User
)
.
filter
(
User
.
id
==
corpus
.
user_id
)
.
first
()
message
=
draft
%
(
corpus
.
name
,
BASE_URL
,
corpus
.
parent_id
,
corpus
.
id
)
message
=
draft
%
(
corpus
.
name
,
settings
.
BASE_URL
,
corpus
.
parent_id
,
corpus
.
id
)
if
user
.
email
!=
""
:
send_mail
(
'[Gargantext]
%
s'
%
subject
...
...
gargantext/util/toolchain/main.py
View file @
24cd6f49
from
gargantext.settings
import
DEBUG
from
django.conf
import
settings
from
.parsing
import
parse
from
.ngrams_extraction
import
extract_ngrams
from
.hyperdata_indexing
import
index_hyperdata
...
...
@@ -176,7 +176,7 @@ def parse_extract_indexhyperdata(corpus):
session
.
commit
()
if
DEBUG
is
False
:
if
settings
.
DEBUG
is
False
:
print
(
'CORPUS #
%
d: [
%
s] FINISHED Sending email notification'
%
(
corpus
.
id
,
t
()))
notify_owner
(
corpus
)
...
...
@@ -299,7 +299,7 @@ def recount(corpus_id):
corpus
.
save_hyperdata
()
session
.
commit
()
if
not
DEBUG
:
if
not
settings
.
DEBUG
:
print
(
'RECOUNT #
%
d: [
%
s] FINISHED Sending email notification'
%
(
corpus
.
id
,
t
()))
notify_recount
(
corpus
)
...
...
gargantext/util/toolchain/ngram_coocs.py
View file @
24cd6f49
...
...
@@ -2,7 +2,6 @@
COOCS
(this is the full SQL version, should be more reliable on outerjoin)
"""
from
gargantext
import
settings
from
sqlalchemy
import
exc
from
gargantext.util.lists
import
WeightedMatrix
from
gargantext.util.db
import
get_engine
...
...
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