Fix para bucle infinito cuando no hay palabras en Redis, y cuenta de twitter añadida al pie de página
This commit is contained in:
parent
7e0f6c43fc
commit
706fc1fd9b
|
@ -56,7 +56,7 @@ def index(request):
|
||||||
else:
|
else:
|
||||||
sform = SilabasForm(initial={'texto': ''})
|
sform = SilabasForm(initial={'texto': ''})
|
||||||
|
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
cform = ContactForm(request.POST)
|
cform = ContactForm(request.POST)
|
||||||
if cform.is_valid():
|
if cform.is_valid():
|
||||||
|
@ -64,19 +64,20 @@ def index(request):
|
||||||
else:
|
else:
|
||||||
cform = ContactForm(initial={'message': '', 'sender': ''})
|
cform = ContactForm(initial={'message': '', 'sender': ''})
|
||||||
|
|
||||||
|
|
||||||
response['sform'] = sform
|
response['sform'] = sform
|
||||||
response['cform'] = cform
|
response['cform'] = cform
|
||||||
|
|
||||||
response['randoms'] = set()
|
response['randoms'] = set()
|
||||||
while len(response['randoms']) < 15:
|
silabas_all_len = r.scard("silabas:all")
|
||||||
|
while len(response['randoms']) < 15 and silabas_all_len > len(response['randoms']):
|
||||||
response['randoms'].add( r.srandmember("silabas:all") )
|
response['randoms'].add( r.srandmember("silabas:all") )
|
||||||
|
|
||||||
response['mostused'] = r.zrevrange("silabas:mostused", 0, 14)
|
response['mostused'] = r.zrevrange("silabas:mostused", 0, 14)
|
||||||
|
|
||||||
if 'lista_silabas' in response and len(response['lista_silabas']) == 1:
|
if 'lista_silabas' in response and len(response['lista_silabas']) == 1:
|
||||||
response['title'] = response['lista_silabas'][0]
|
response['title'] = response['lista_silabas'][0]
|
||||||
|
|
||||||
response.update(csrf(request))
|
response.update(csrf(request))
|
||||||
|
|
||||||
return render_to_response('home/index.html', response)
|
return render_to_response('home/index.html', response)
|
||||||
|
|
|
@ -71,7 +71,7 @@ STATICFILES_DIRS = (
|
||||||
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||||
# Always use forward slashes, even on Windows.
|
# Always use forward slashes, even on Windows.
|
||||||
# Don't forget to use absolute paths, not relative paths.
|
# Don't forget to use absolute paths, not relative paths.
|
||||||
'/home/salvarez/www/silabas/public/static',
|
'/home/salvarez/www/silabas.xrg.es/public/static',
|
||||||
)
|
)
|
||||||
|
|
||||||
# List of finder classes that know how to find static files in
|
# List of finder classes that know how to find static files in
|
||||||
|
@ -108,7 +108,7 @@ ROOT_URLCONF = 'silabas.urls'
|
||||||
WSGI_APPLICATION = 'silabas.wsgi.application'
|
WSGI_APPLICATION = 'silabas.wsgi.application'
|
||||||
|
|
||||||
TEMPLATE_DIRS = (
|
TEMPLATE_DIRS = (
|
||||||
'/home/salvarez/www/silabas/templates'
|
'/home/salvarez/www/silabas.xrg.es/templates'
|
||||||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
||||||
# Always use forward slashes, even on Windows.
|
# Always use forward slashes, even on Windows.
|
||||||
# Don't forget to use absolute paths, not relative paths.
|
# Don't forget to use absolute paths, not relative paths.
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<p class="toright">Sitio creado por <a href="https://sergio.am">Sergio Álvarez Muñoz</a>
|
<p class="toright">Sitio creado por <a href="https://sergio.am">Sergio Álvarez Muñoz</a>
|
||||||
(<a href="mailto:xergio@gmail.com?subject=Sílabas">xergio@gmail.com</a>)
|
(<a href="mailto:xergio@gmail.com?subject=Sílabas">xergio@gmail.com</a> ó <a href="https://twitter.com/xergio">@xergio</a>)
|
||||||
<small>usando <a href="http://www.nginx.org">nginx</a>,
|
<small>usando <a href="http://www.nginx.org">nginx</a>,
|
||||||
<a href="https://www.djangoproject.com/">Django</a>,
|
<a href="https://www.djangoproject.com/">Django</a>,
|
||||||
<a href="http://redis.io">Redis</a> y
|
<a href="http://redis.io">Redis</a> y
|
||||||
<a href="http://twitter.github.com/bootstrap/">Bootstrap CSS</a>. <a href="https://github.com/xergio/silabas"><code>código fuente</code></a>.</small>. <span class="temporal need design"><a href="/media/silabas.html">Lista de palabras en castellano para separar en sílabas</a></</span></p>
|
<a href="http://twitter.github.com/bootstrap/">Bootstrap CSS</a>. <a href="https://github.com/xergio/silabas"><code>código fuente</code></a>.</small>. <span class="temporal need design"><a href="/media/silabas.html">Lista de palabras en castellano para separar en sílabas</a></span></p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue