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):
n.type_id = %d
AND
ngX.n >= 2
AND
ngX.n <= 3
GROUP BY
ngX.id
......@@ -254,7 +257,7 @@ def tfidf(corpus, document, ngram):
# result = tf * idf
result = term_frequency * inverse_d_frequency
except Exception as error:
print(error)
print(error, ngram)
result = 0
return result
......
......@@ -341,41 +341,41 @@ def corpus(request, project_id, corpus_id):
# except:
# sources_donut = []
# Do a javascript query/api for that
query_date = """
SELECT
id,
metadata -> 'publication_year' as year,
metadata -> 'publication_month' as month,
metadata -> 'publication_day' as day,
metadata -> 'title'
FROM
node_node AS n
WHERE
n.parent_id = %d
ORDER BY
year, month, day DESC
LIMIT
20
OFFSET
%d
""" % (corpus.id, 0)
try:
cursor = connection.cursor()
cursor.execute(query_date)
documents = list()
while True:
document = dict()
row = cursor.fetchone()
if row is None:
break
document['id'] = row[0]
document['date'] = row[1] + '/' + row[2] + '/' + row[3]
document['title'] = row[4]
documents.append(document)
except Exception as error:
print(error)
# query_date = """
# SELECT
# id,
# metadata -> 'publication_year' as year,
# metadata -> 'publication_month' as month,
# metadata -> 'publication_day' as day,
# metadata -> 'title'
# FROM
# node_node AS n
# WHERE
# n.parent_id = %d
# ORDER BY
# year, month, day DESC
# LIMIT
# 20
# OFFSET
# %d
# """ % (corpus.id, 0)
# try:
# cursor = connection.cursor()
#
# cursor.execute(query_date)
# documents = list()
# while True:
# document = dict()
# row = cursor.fetchone()
#
# if row is None:
# break
# document['id'] = row[0]
# document['date'] = row[1] + '/' + row[2] + '/' + row[3]
# document['title'] = row[4]
# documents.append(document)
# except Exception as error:
# print(error)
try:
chart = dict()
......@@ -390,7 +390,7 @@ def corpus(request, project_id, corpus_id):
'date': date,\
'project': project,\
'corpus' : corpus,\
'documents': documents,\
# 'documents': documents,\
'number' : number,\
'dates' : chart,\
}))
......
......@@ -139,4 +139,18 @@ Start the Django server
-----------------------
in bash to launch python env : /srv/gargantext_env/bin/activate
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):
if encoding != "utf-8":
try:
contents = contents.decode("latin1", errors='replace').encode(codif)
except :
try:
contents = contents.decode(encoding, errors='replace').encode(codif)
except Exception as error:
print(error)
except Exception as error:
print(error)
# try:
# contents = contents.decode(encoding, errors='replace').encode(codif)
# except Exception as error:
# print(error)
try:
html_parser = etree.HTMLParser(encoding=codif)
......
......@@ -24,12 +24,16 @@
<div class="row">
<div class="content">
<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>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support this video sorry. Try Firefox or Chromium.
</video>
--!>
</center>
</div>
</div>
......
......@@ -22,7 +22,6 @@
{% if documents %}
<p>Paginator stuff</p>
<ul>
{% for doc in documents %}
{% if doc.date %}
......@@ -31,4 +30,4 @@
{% endfor %}
</ul>
{% endif %}
\ No newline at end of file
{% endif %}
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