Skip to content

Instantly share code, notes, and snippets.

@eucandre
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eucandre/1be6120bf51a09a5a62a to your computer and use it in GitHub Desktop.
Save eucandre/1be6120bf51a09a5a62a to your computer and use it in GitHub Desktop.
settings.py
#-*-coding:cp1252
# Django settings for budegadasartes project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ROOTDIR = os.path.realpath(os.path.dirname(__file__))
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'budegadasartes.db', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': '',#admin',
'PASSWORD': '',#1',
'HOST': '',#localhost', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = []
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Maceio'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'pt-br'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = 'C:/Projeto Budega das artes/budegadasartes/media'#os.path.join(ROOTDIR,'media')#'/apps_wsgi/budegadasartes/media'#'C:/Projeto Budega das artes/budegadasartes/media'#os.path.join(ROOTDIR,'media')#''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = '/media/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = ''
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
# Additional locations of static files
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.
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 't=$xd_en5t+pf0s0oac!@vn6su=sy7eh3fdg0v7xxv0b5v-kbz'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.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',
)
ROOT_URLCONF = 'budegadasartes.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'budegadasartes.wsgi.application'
import os
#-*-coding:cp1252-*-
TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), '..', 'templates').replace('\\','/'),)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'budega_App',
)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
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,
},
}
}
models.py
class Imagens(models.Model):
nome_imagem = models.CharField(max_length=150)
imagem = models.ImageField(upload_to='imagens_ventos',)
# lista_Imagens = glob.glob("C:/Projeto Budega das artes/budegadasartes/media/imagens_ventos/*.jpg")
def __unicode__(self):
#self.imagem=self.nome_imagem
return self.nome_imagem
class Evento(models.Model):
Nome = models.CharField(max_length=150)
Img = models.ForeignKey(Imagens)
#imama = models.FilePathField(max_length=500)
#imagens = models.ImageField(upload_to="imagens_ventos")
Data_evento = models.DateField()
hora = models.TimeField(blank=True, help_text="hora do evento")
precedencia = models.BooleanField(blank=True, help_text='caso o evento seja precedente para nós, marque, entra em uma fila!')
valor = models.FloatField()
Local_evento = models.ForeignKey(endereco)
def __unicode__(self):
return self.Nome
views.py
def Lista(request):
context = {'objeto':Evento.objects.get(id=5),}
return render(request, 'teste.html', context)
slides.html
{% extends 'base.html' %}
{% for item in objeto.Img.all %}
{% block paginaslider %}
<!DOCTYPE html>
<html>
<head>
<title>Parte dos slides</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="cssSlider created with cssSlider, a free wizard program that helps you easily generate beautiful web slideshow" />
</head>
<body style="background-color:#d7d7d7; margin: auto; text-align: center;">
<!-- Start cssSlider.com -->
<link rel="stylesheet" href="media/engine1/style.css">
<!--[if IE]><link rel="stylesheet" href="engine1/ie.css"><![endif]-->
<!--[if lte IE 9]><script type="text/javascript" src="engine1/ie.js"></script><![endif]-->
<div class='csslider1 autoplay '>
<input name="cs_anchor1" id='cs_slide1_0' type="radio" class='cs_anchor slide' >
<input name="cs_anchor1" id='cs_slide1_1' type="radio" class='cs_anchor slide' >
<input name="cs_anchor1" id='cs_slide1_2' type="radio" class='cs_anchor slide' >
<input name="cs_anchor1" id='cs_slide1_3' type="radio" class='cs_anchor slide' >
<input name="cs_anchor1" id='cs_slide1_4' type="radio" class='cs_anchor slide' >
<input name="cs_anchor1" id='cs_play1' type="radio" class='cs_anchor' checked>
<input name="cs_anchor1" id='cs_pause1' type="radio" class='cs_anchor' >
<ul>
<div style="width: 100%; visibility: hidden; font-size: 0px; line-height: 0;">
<img src="/media/data1/images/agito.jpg" style="width: 100%;">
</div>
<li class='num0 img'>
<img src='/media/imagens_ventos/{{ item.nome_imagem }}' alt='agito' title='agito' />
</li>
<li class='num1 img'>
<img src='/media/data1/images/bandas_imagem.jpg' alt='bandas imagem' title='bandas imagem' />
</li>
<li class='num2 img'>
<img src='/media/data1/images/bodegadsaetes.png' alt='bodegadsaetes' title='bodegadsaetes' />
</li>
<li class='num3 img'>
<img src='/media/data1/images/images_festa_colorida_e_banda.jpg' alt='images_festa_colorida_e_banda' title='images_festa_colorida_e_banda' />
</li>
<li class='num4 img'>
<img src='/media/data1/images/logomarca.jpg' alt='Logomarca' title='Logomarca' />
</li>
</ul>
<a class="cs_lnk" href="http://cssslider.com">image slider</a>
<div class='cs_description'>
<label class='num0'>
<span class="cs_title"><span class="cs_wrapper">agito</span></span>
</label>
<label class='num1'>
<span class="cs_title"><span class="cs_wrapper">bandas imagem</span></span>
</label>
<label class='num2'>
<span class="cs_title"><span class="cs_wrapper">bodegadsaetes</span></span>
</label>
<label class='num3'>
<span class="cs_title"><span class="cs_wrapper">images_festa_colorida_e_banda</span></span>
</label>
<label class='num4'>
<span class="cs_title"><span class="cs_wrapper">Logomarca</span></span>
</label>
</div>
<div class='cs_arrowprev'>
<label class='num0' for='cs_slide1_0'></label>
<label class='num1' for='cs_slide1_1'></label>
<label class='num2' for='cs_slide1_2'></label>
<label class='num3' for='cs_slide1_3'></label>
<label class='num4' for='cs_slide1_4'></label>
</div>
<div class='cs_arrownext'>
<label class='num0' for='cs_slide1_0'></label>
<label class='num1' for='cs_slide1_1'></label>
<label class='num2' for='cs_slide1_2'></label>
<label class='num3' for='cs_slide1_3'></label>
<label class='num4' for='cs_slide1_4'></label>
</div>
<div class='cs_bullets'>
<label class='num0' for='cs_slide1_0'>
<span class='cs_point'></span>
<span class='cs_thumb'><img src='media/data1/tooltips/agito.jpg' alt='agito' title='agito' /></span>
</label>
<label class='num1' for='cs_slide1_1'>
<span class='cs_point'></span>
<span class='cs_thumb'><img src='media/data1/tooltips/bandas_imagem.jpg' alt='bandas imagem' title='bandas imagem' /></span>
</label>
<label class='num2' for='cs_slide1_2'>
<span class='cs_point'></span>
<span class='cs_thumb'><img src='media/data1/tooltips/bodegadsaetes.png' alt='bodegadsaetes' title='bodegadsaetes' /></span>
</label>
<label class='num3' for='cs_slide1_3'>
<span class='cs_point'></span>
<span class='cs_thumb'><img src='media/data1/tooltips/images_festa_colorida_e_banda.jpg' alt='images_festa_colorida_e_banda' title='images_festa_colorida_e_banda' /></span>
</label>
<label class='num4' for='cs_slide1_4'>
<span class='cs_point'></span>
<span class='cs_thumb'><img src='media/data1/tooltips/logomarca.jpg' alt='Logomarca' title='Logomarca' /></span>
</label>
</div>
</div>
<!-- End cssSlider.com -->
</body>
</html>
{% endblock %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment