Commit 5446daa2 authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

registro

parent cd99ddf5
#Installation #Installation
```bash ```bash
sudo apt-get install git python3 python3-pip psycopg2-binary sudo apt-get install git python3 python3-dev python3-pip psycopg2-binary postgresql postgresql-contrib
python3 -m pip install --upgrade pip python3 -m pip install --upgrade pip
sudo pip3 intsall django django-mathfilters psycopg2 django-static-jquery sudo pip3 intsall django django-mathfilters psycopg2 django-static-jquery quantiphy numpy wordcloud stop_words
sudo su - postgres
psql
CREATE DATABASE m3db;
CREATE USER geoint WITH PASSWORD 'geoint';
ALTER ROLE geoint SET client_encoding TO 'utf8';
ALTER ROLE geoint SET default_transaction_isolation TO 'read committed';
ALTER ROLE geoint SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE m3db TO geoint;
\q
exit
cd m3_webinterface/
python3 manage.py makemigrations
``` ```
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
# Register your models here.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class AccountsConfig(AppConfig):
name = 'accounts'
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
# Create your models here.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
# Create your tests here.
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^signup/', views.SignUp.as_view(), name='signup'),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
# Create your views here.
from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
from django.views import generic
class SignUp(generic.CreateView):
form_class = UserCreationForm
success_url = reverse_lazy('login')
template_name = 'signup.html'
from django.shortcuts import HttpResponseRedirect from django.shortcuts import HttpResponseRedirect
from django.core.urlresolvers import reverse #from django.core.urlresolvers import reverse
from django.urls import reverse
class AuthRequiredMiddleware(object): class AuthRequiredMiddleware(object):
def __init__(self, get_response): def __init__(self, get_response):
...@@ -16,7 +18,7 @@ class AuthRequiredMiddleware(object): ...@@ -16,7 +18,7 @@ class AuthRequiredMiddleware(object):
if request.path_info == reverse('ws-news-list2'): if request.path_info == reverse('ws-news-list2'):
return response return response
if not request.user.is_authenticated() and request.path_info != reverse('login'): if not request.user.is_authenticated and request.path_info != reverse('login'):
return HttpResponseRedirect(reverse('login')) return HttpResponseRedirect(reverse('login'))
# Code to be executed for each request/response after # Code to be executed for each request/response after
......
No preview for this file type
...@@ -37,3 +37,7 @@ video { ...@@ -37,3 +37,7 @@ video {
opacity:0.8; opacity:0.8;
} }
form span_
{
display: none;
}
m3Data={"users": 17, "publishers": 80, "text": 62, "audio": 17, "documents": 3743812, "searches": 43, "audioTime": 5182281}; m3Data={"users": 18, "publishers": 80, "text": 62, "audio": 17, "documents": 3814507, "searches": 47, "audioTime": 5571159};
\ No newline at end of file \ No newline at end of file
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
{% block headMedia %} {% block headMedia %}
<script type="text/javascript" src="{% static 'static_jquery/js/jquery.js' %}" ></script> <!--<script type="text/javascript" src="{% static 'static_jquery/js/jquery.js' %}" ></script>
<script type="text/javascript" src="{% static 'admin/js/jquery.init.js' %}" ></script> <script type="text/javascript" src="{% static 'admin/js/jquery.init.js' %}" ></script>
{{ form.media }} {{ form.media }}-->
{% endblock %} {% endblock %}
...@@ -41,9 +41,8 @@ ...@@ -41,9 +41,8 @@
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script> <script type="text/javascript" src="{% static 'admin/js/jquery.init.js' %}" ></script>
{{ form.media }}
</script>
{% endblock %} {% endblock %}
from django.conf.urls import url from django.conf.urls import url
from . import views from . import views
from django.views.i18n import javascript_catalog from django.views.i18n import JavaScriptCatalog
urlpatterns = [ urlpatterns = [
url(r'^$', views.index, name='index'), url(r'^$', views.index, name='index'),
url(r'^status/$', views.status, name='status'), url(r'^status/$', views.status, name='status'),
url(r'^js/jsi18n/$', javascript_catalog, name='jsi18n'), url(r'^js/jsi18n/$', JavaScriptCatalog.as_view(), name='jsi18n'),
url(r'^publishers/$', views.publisherList, name='publishers-list'), url(r'^publishers/$', views.publisherList, name='publishers-list'),
url(r'^publishers/(?P<type>\w+)$', views.publisherList, name='publishers-list'), url(r'^publishers/(?P<type>\w+)$', views.publisherList, name='publishers-list'),
......
...@@ -12,7 +12,8 @@ from django.shortcuts import redirect ...@@ -12,7 +12,8 @@ from django.shortcuts import redirect
from django.http import HttpResponse from django.http import HttpResponse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.db.models import Count from django.db.models import Count
from django.core.urlresolvers import reverse #from django.core.urlresolvers import reverse
from django.urls import reverse
from django.db.models.functions import TruncMonth, TruncYear from django.db.models.functions import TruncMonth, TruncYear
from .forms import SearchForm, ProfileForm, SubscriptionsForm from .forms import SearchForm, ProfileForm, SubscriptionsForm
......
#! /bin/sh
### BEGIN INIT INFO
# Provides: m3
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts m3
# Description: starts m3 using start-stop-daemon
# Copiar en /etc/init.d/
# update-rc.d -f m3_init defaults
# update-rc.d -f m3_init enable 2 3 4 5
### END INIT INFO
# Some things that run always
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "m3 iniciado..."
python3 /home/geoint/m3_webInterface/manage.py runserver 192.168.0.112:8001
;;
stop)
echo "Deteniendo m3..."
#
;;
*)
echo "Usage: /etc/init.d/m3_init {start|stop}"
exit 1
;;
esac
exit 0
...@@ -40,6 +40,7 @@ INSTALLED_APPS = [ ...@@ -40,6 +40,7 @@ INSTALLED_APPS = [
'django.contrib.humanize', 'django.contrib.humanize',
'mathfilters', 'mathfilters',
'catalog.apps.CatalogConfig', 'catalog.apps.CatalogConfig',
'accounts.apps.AccountsConfig',
'django.contrib.postgres', 'django.contrib.postgres',
'django_static_jquery', 'django_static_jquery',
......
...@@ -19,12 +19,13 @@ from django.conf.urls import include ...@@ -19,12 +19,13 @@ from django.conf.urls import include
from django.views.generic import RedirectView from django.views.generic import RedirectView
from django.conf.urls.static import static from django.conf.urls.static import static
from django.conf import settings from django.conf import settings
from django.views.i18n import javascript_catalog #from django.views.i18n import javascript_catalog
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^catalog/', include('catalog.urls')), url(r'^catalog/', include('catalog.urls')),
url(r'^$', RedirectView.as_view(url='/catalog/', permanent=True)), url(r'^$', RedirectView.as_view(url='/catalog/', permanent=True)),
url(r'^accounts/', include('accounts.urls')),
url(r'^accounts/', include('django.contrib.auth.urls')), url(r'^accounts/', include('django.contrib.auth.urls')),
# url(r'^ws/reports/images/(?P<type>\w+)$', views.wsReportImages, name='wsReportImages') # url(r'^ws/reports/images/(?P<type>\w+)$', views.wsReportImages, name='wsReportImages')
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
This diff is collapsed.
<!-- templates/signup.html -->
{% extends 'landing_base.html' %}
{% block title %}Registro{% endblock %}
{% block content %}
<div class="panel panel-green">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-pencil fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
{% if form.errors %}
<p>{{form.username.help_text}}</p>
{% endif %}
<form role="form" method="post">
{% csrf_token %}
<div class="form-group">
<input class="form-control" placeholder="nombre de usuario" name="username" type="" id="id_username" autofocus>
</div>
<div class="form-group">
<input class="form-control" placeholder="contraseña" name="password1" type="password" id="id_password1" autofocus>
</div>
<div class="form-group">
<input class="form-control" placeholder="confirmar contraseña" name="password2" type="password" id="id_password2" autofocus>
</div>
<div class="form-group">
<input type="submit" value="Registrarse" class="btn btn-lg btn-success btn-block" />
<input type="hidden" name="next" value="" />
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}
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