Commit 1d1a297a authored by PkSM3's avatar PkSM3

Merge branch 'unstable' of ssh://delanoe.org:1979/gargantext into samuel

parents d790f62d 21fec896
...@@ -54,6 +54,9 @@ def create_whitelist(user, corpus, size=100): ...@@ -54,6 +54,9 @@ def create_whitelist(user, corpus, size=100):
n.type_id = %d n.type_id = %d
AND AND
ngX.n >= 2 ngX.n >= 2
AND
ngX.n <= 3
GROUP BY GROUP BY
ngX.id ngX.id
...@@ -254,7 +257,7 @@ def tfidf(corpus, document, ngram): ...@@ -254,7 +257,7 @@ def tfidf(corpus, document, ngram):
# result = tf * idf # result = tf * idf
result = term_frequency * inverse_d_frequency result = term_frequency * inverse_d_frequency
except Exception as error: except Exception as error:
print(error) print(error, ngram)
result = 0 result = 0
return result return result
......
...@@ -341,41 +341,41 @@ def corpus(request, project_id, corpus_id): ...@@ -341,41 +341,41 @@ def corpus(request, project_id, corpus_id):
# except: # except:
# sources_donut = [] # sources_donut = []
# Do a javascript query/api for that # Do a javascript query/api for that
query_date = """ # query_date = """
SELECT # SELECT
id, # id,
metadata -> 'publication_year' as year, # metadata -> 'publication_year' as year,
metadata -> 'publication_month' as month, # metadata -> 'publication_month' as month,
metadata -> 'publication_day' as day, # metadata -> 'publication_day' as day,
metadata -> 'title' # metadata -> 'title'
FROM # FROM
node_node AS n # node_node AS n
WHERE # WHERE
n.parent_id = %d # n.parent_id = %d
ORDER BY # ORDER BY
year, month, day DESC # year, month, day DESC
LIMIT # LIMIT
20 # 20
OFFSET # OFFSET
%d # %d
""" % (corpus.id, 0) # """ % (corpus.id, 0)
try: # try:
cursor = connection.cursor() # cursor = connection.cursor()
#
cursor.execute(query_date) # cursor.execute(query_date)
documents = list() # documents = list()
while True: # while True:
document = dict() # document = dict()
row = cursor.fetchone() # row = cursor.fetchone()
#
if row is None: # if row is None:
break # break
document['id'] = row[0] # document['id'] = row[0]
document['date'] = row[1] + '/' + row[2] + '/' + row[3] # document['date'] = row[1] + '/' + row[2] + '/' + row[3]
document['title'] = row[4] # document['title'] = row[4]
documents.append(document) # documents.append(document)
except Exception as error: # except Exception as error:
print(error) # print(error)
try: try:
chart = dict() chart = dict()
...@@ -390,7 +390,7 @@ def corpus(request, project_id, corpus_id): ...@@ -390,7 +390,7 @@ def corpus(request, project_id, corpus_id):
'date': date,\ 'date': date,\
'project': project,\ 'project': project,\
'corpus' : corpus,\ 'corpus' : corpus,\
'documents': documents,\ # 'documents': documents,\
'number' : number,\ 'number' : number,\
'dates' : chart,\ 'dates' : chart,\
})) }))
......
...@@ -139,4 +139,18 @@ Start the Django server ...@@ -139,4 +139,18 @@ Start the Django server
----------------------- -----------------------
in bash to launch python env : /srv/gargantext_env/bin/activate in bash to launch python env : /srv/gargantext_env/bin/activate
In Pyvenv: In Pyvenv:
python manage.py runserver $ python manage.py runserver
For Production Server
---------------------
git checkout stable
$ sudo aptitude install rabbitmq-server
$ sudo aptitude install tmux
# In your python envrionment:
$ tmux -c ./manage.py celery worker --loglevel=info
$ python manage.py runserver
Here informations for installation:
-----------------------------------
I - Local Installation
All informations are in init folder
1) Create virtualenv with python version 3.4
2) pip install -r requirements.txt
3) Manually install nltk (inside the sources)
nltk==3.0a4
4) adapt database configuration in gargantext_web settings
(Development done on postgresql)
5) source env/bin/activate
6) ./manage.py runserver
That's all
...@@ -28,11 +28,12 @@ class EuropressFileParser(FileParser): ...@@ -28,11 +28,12 @@ class EuropressFileParser(FileParser):
if encoding != "utf-8": if encoding != "utf-8":
try: try:
contents = contents.decode("latin1", errors='replace').encode(codif) contents = contents.decode("latin1", errors='replace').encode(codif)
except : except Exception as error:
try: print(error)
contents = contents.decode(encoding, errors='replace').encode(codif) # try:
except Exception as error: # contents = contents.decode(encoding, errors='replace').encode(codif)
print(error) # except Exception as error:
# print(error)
try: try:
html_parser = etree.HTMLParser(encoding=codif) html_parser = etree.HTMLParser(encoding=codif)
......
...@@ -24,12 +24,16 @@ ...@@ -24,12 +24,16 @@
<div class="row"> <div class="row">
<div class="content"> <div class="content">
<center> <center>
<img src="http://s3.lprs1.fr/images/2015/01/08/4429565_je-suis-charlie_545x460_autocrop.jpg" alt="Je suis Charlie" style="100px; height:150px">
<!--
<h2>Introduction Video</h2> <h2>Introduction Video</h2>
<video width="320" height="240" controls> <video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4"> <source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg"> <source src="movie.ogg" type="video/ogg">
Your browser does not support this video sorry. Try Firefox or Chromium. Your browser does not support this video sorry. Try Firefox or Chromium.
</video> </video>
--!>
</center> </center>
</div> </div>
</div> </div>
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
{% if documents %} {% if documents %}
<p>Paginator stuff</p>
<ul> <ul>
{% for doc in documents %} {% for doc in documents %}
{% if doc.date %} {% if doc.date %}
...@@ -31,4 +30,4 @@ ...@@ -31,4 +30,4 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment