SHARE
TWEET

Untitled

a guest Dec 29th, 2016 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <VirtualHost *:80>
  2.     ServerName myapp.cl
  3.     ServerAlias *.myapp.cl myapp.cl
  4.     Alias /static /home/ubuntu/django_projects/myapp/static
  5.     <Directory /home/ubuntu/django_projects/myapp/static>
  6.         Require all granted
  7.     </Directory>
  8.     <Directory /home/ubuntu/django_projects/myapp/myapp>
  9.         <Files wsgi.py>
  10.             Require all granted
  11.         </Files>
  12.     </Directory>
  13.     WSGIProcessGroup myapp
  14.     WSGIDaemonProcess myapp python-path=/home/ubuntu/django_projects/myapp
  15.     WSGIScriptAlias / /home/ubuntu/django_projects/myapp/myapp/wsgi.py process-group=myapp application-group=%{GLOBAL}
  16. </VirtualHost>
  17.    
  18. rom django.conf.urls import url, include
  19. from django.contrib import admin
  20. from . import views as views_ini
  21. from django.contrib.auth.views import login, logout,  password_change, password_change_done
  22. from myapp.views import aviso_sistema, inicio, LoginForm
  23.  
  24.  
  25.  
  26. urlpatterns = [
  27.     url(r'^admin/', admin.site.urls),
  28.  
  29.  
  30.     url(r'^login/$', login, {'template_name': 'loginrex.html',
  31.                                        'authentication_form': LoginForm,
  32.                                        }, name='django.contrib.auth.views.login'),
  33.  
  34.     url(r'^logout/$', logout, {'next_page': '/login'}, name='logout'),
  35.  
  36.  
  37.     # ....Avisos del sistema
  38.     url(r'^aviso_sistema/(?P<titulo>[w ]+)/(?P<detalle>[w ]+)/(?P<tipo>[w ]+)$', aviso_sistema, name='aviso_sistema'),
  39.  
  40. ]
  41.    
  42. from django.shortcuts import render, redirect, get_object_or_404
  43. from django.contrib.auth.decorators import login_required
  44. from django.contrib.auth.forms import AuthenticationForm
  45. from django import forms
  46. from myapp.definiciones.preferenciasDefi import unaPref
  47. from myapp.deposito import procesoAnombre
  48. from django.shortcuts import redirect
  49. from django.conf import settings
  50.  
  51. @login_required()
  52. def inicio(request):
  53.     #if not request.user.is_authenticated:
  54.     #   raise ValueError('Usuario OK pero no logueado')
  55.     #   return redirect('%s?next=%s' % (settings.LOGIN_URL, request.path))
  56.  
  57.     mdp = unaPref('mesActual')
  58.     dato = procesoAnombre(mdp)
  59.     datos = {
  60.         'mmp': dato,
  61.         'idv': ' ',
  62.     }
  63.     return render(request, 'inicio.html', datos)
  64.  
  65. class LoginForm(AuthenticationForm):
  66.     username = forms.CharField(label="Usuario", max_length=30,
  67.                                widget=forms.TextInput(attrs={'class': 'form-control', 'name': 'username'}),
  68.                                )
  69.     password = forms.CharField(label="Clave", max_length=30,
  70.                                widget=forms.PasswordInput(attrs={'class': 'form-control', 'name': 'password'}),
  71.                                )
  72.  
  73. # ........Genera los avisos del sistema
  74. def aviso_sistema(request, titulo, detalle, tipo):
  75.  
  76.     datos = {
  77.         'titulo': titulo,
  78.         'detalle': detalle,
  79.         'tipo': tipo,
  80.     }
  81.     return render(request, 'aviso_sistema.html', datos)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top