-
DATOS PARA EL SANDBOX DE PAYPAL ======== comprador@joinity.com -> C4s10p34
-
RUN SERVER =======
Para incializar el servidor: python manage.py runserver localhost:8000
- SOBRE EL DATE-PICKER ==================== La estructura a copiar/pegar es la siguiente:
El enlace a la documentaciĂłn del date-pick de jquery-ui es http://api.jqueryui.com/datepicker/
- INSTRUCCIONES PARA QUE FUNCIONE AJAX =======================================
a. Instalamos el paquete de python dajaxice. Podemos descargarlo de: https://github.com/jorgebastida/django-dajaxice y los instalamos como cualquier paquete normal de python.
b. En nuestro proyecto de joinity sustituimos el archivo joinity/settings.py por este (cambiando las rutas de mi ordenador a las tuyas): https://www.dropbox.com/s/xqrmeovbbgnl30h/settings.py
c. En nuestro proyecto de joinity sustituimos el archivo jonity/urls.py por este: https://www.dropbox.com/s/xqrmeovbbgnl30h/settings.py
d. En cualquier app instalada de joinity creamos un nuevo archivo .py con los datos que tengamos que pasar por ajax. Un ejemplo (lo que se pasa es lo que está en el interior de la string. Yo he usado texto plano pero obviamente podemos pasar cualquier tipo de datos):
from django.utils import simplejson
def sayhello(request): return simplejson.dumps({'message':'Este mensaje esta en el servidor y funciona'}) from django.utils import simplejson from dajaxice.decorators import dajaxice_register
@dajaxice_register def sayhello(request): return simplejson.dumps({'message':'Este mensaje esta en el servidor y funciona'})
e. Fase final: los templates.
e.1. Editamos el head del html y añadimos:
-Antes de abrir la etiqueta html:
{% load dajaxice_templatetags %}
-Antes de cerrar la etiqueta head:
{% dajaxice_js_import %}
e.2. Donde queramos cargar el contenido ajax, sĂłlo hay que llamarlo a travĂ©s de una funciĂłn de javascript, de este modo (de hecho, hazlo asĂ cargándolo en un alert y ya me encargo yo de cargarlo en el html como tendrĂa que ser):
<button onclick="Dajaxice.example.sayhello(my_js_callback);" class="btn btn-big" style="margin:200px;">Quiero ver Ajax en acciĂłn</button>
e.3. En el archivo de funciones de javascript (esto ya lo hago yo) añadimos esto: function my_js_callback(data){ alert(data.message); }
- ARCHIVO SETTINGS DE FERNANDO ============================
DEBUG = True TEMPLATE_DEBUG = DEBUG LOCALHOST = True ADMINS = ( ('Girien', 'antoniespinosa@me.com'), )
MANAGERS = ADMINS if LOCALHOST: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'joinity', # Or path to database file if using sqlite3. # The following settings are not used with sqlite3: 'USER': 'joinity', 'PASSWORD': 'C4s10p34', 'HOST': 'bueninvento.net', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 'PORT': '3306', # Set to empty string for default. } } else: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'joinity', # Or path to database file if using sqlite3. # The following settings are not used with sqlite3: 'USER': 'joinity', 'PASSWORD': 'C4s10p34', 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 'PORT': '3306', # Set to empty string for default. } }
ALLOWED_HOSTS = []
TIME_ZONE = 'Europe/Madrid'
LANGUAGE_CODE = 'es-ES'
SITE_ID = 1
USE_I18N = True
USE_L10N = True
USE_TZ = True
if LOCALHOST: MEDIA_ROOT = '/Volumes/Macintosh HD/Users/fguirao/Dropbox/Bueninvento/Proyectos/Joinity/Taller/App/media/' else: MEDIA_ROOT = '/var/www/vhosts/bueninvento.net/proyectos/django/prueba1/media/'
Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = '/media/'
if LOCALHOST: STATIC_ROOT = '/Volumes/Macintosh HD/Users/fguirao/Dropbox/Bueninvento/Proyectos/Joinity/Taller/App/' else: STATIC_ROOT = '/Volumes/Macintosh HD/Users/fguirao/Dropbox/Bueninvento/Proyectos/Joinity/Taller/App/static/'
Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
if LOCALHOST: STATICFILES_DIRS = ( # Put strings here, like "/home/html/static" or "C:/www/django/static". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. '/Volumes/Macintosh HD/Users/fguirao/Dropbox/Bueninvento/Proyectos/Joinity/Taller/App/static/', ) else: STATICFILES_DIRS = ( # Put strings here, like "/home/html/static" or "C:/www/django/static". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. '/var/www/vhosts/bueninvento.net/proyectos/django/prueba1/static/', )
STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
SECRET_KEY = '0_w-suhuj+janxkz95hjmiigvw9f&h$22c+*!3g-fofik#7wg1'
TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader',
)
MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', # Uncomment the next line for simple clickjacking protection: 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) AUTH_PROFILE_MODULE = 'login.Usuarios' DECIMAL_SEPARATOR = ','
ROOT_URLCONF = 'joinity.urls'
WSGI_APPLICATION = 'joinity.wsgi.application'
if LOCALHOST: TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. '/Volumes/Macintosh HD/Users/fguirao/Dropbox/Bueninvento/Proyectos/Joinity/Taller/App/templates', ) else: TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. '/var/www/vhosts/bueninvento.net/proyectos/django/prueba1/templates/', )
INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'paypal.standard.ipn', 'pagos', 'usuario', 'mensajes', 'amigos', 'django.contrib.admin', 'categorias', 'mathfilters', 'joinitys', 'reservas', )
PAYPAL_RECEIVER_EMAIL = "girienmorfindel@gmail.com"
if LOCALHOST: SITE_NAME = 'http://81.37.96.173/' else: SITE_NAME = 'http://prueba1.bueninvento.net/'
LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_false': { '()': 'django.utils.log.RequireDebugFalse' } }, 'handlers': { 'mail_admins': { 'level': 'ERROR', 'filters': ['require_debug_false'], 'class': 'django.utils.log.AdminEmailHandler' } }, 'loggers': { 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'propagate': True, }, } }