Question about run bash scripts on Django-Python

2015-04-20 Thread David Pineda
Hello
I'm a begginner in django and i need to work with a form (send a file) and
when the file it's ok run a bash scripts to process that.

I investigate and the common recomendation si use 'subprocess'  an 'sys'
So, i can set the path with de bash app, but the system only recognize the
'echo' command but the another like grep, awk or sed they say 'command not
found'. eg:

"home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 70: xlsx2csv: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 71: xlsx2csv: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 72: sed: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 73: sed: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 74: sed: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 77: awk: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 77: sed: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 79: sed: command not found"

So,  i think the bin path it loose when i run from django, and in this
point i'm confused.

How to solve it?

Thanks, very thanks!
-- 
David A. Pineda Osorio
F:+56 9 82142267
Ingeniero Civil Electricista
Universidad de Chile

*http://www.cultura-libre.cl/ *

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAn3imzaozSL-dGPT_U30AP_X4rqVx5cTFV1PMusE81nApHM_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Encoding UTF 8 (añ,etc) and datetime function

2014-01-14 Thread David Pineda
Hello, i'm beginning to learn python+django and i'm doing that handbook 
https://github.com/jacobian/djangobook.com/blob/master/chapter03.rst
In the example whit datetime i have a problem when i active the utf-8 
encondig because i use á,ñ, etc (i'm chilean and we talk in spanish)
So, when i deactive it's works fine, but in the future when i do something 
more i will need the utf8 enconding and all functionalities like datetime 
working and i don't know  yet how to do to make work together that,
Thanks for help me :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/df66d6fa-afbb-4c07-90ea-be19308e5485%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Encoding UTF 8 (añ,etc) and datetime function

2014-01-14 Thread David Pineda
The code:

from django.http import Http404, HttpResponse
import datetime
# coding: utf-8

def hello(request):
return HttpResponse("Hello world")
def home_page(request):
return HttpResponse("Página de Inicio")
def current_datetime(request):
now = datetime.datetime.now()
html = "It is now %s." % now
return HttpResponse(html)
def hours_ahead(request, offset):
try:
offset = int(offset)
except ValueError:
raise Http404()
dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
html = "In %s hour(s), it will be %s." % 
(offset, dt)
return HttpResponse(html)

Whit utf8

SyntaxError at /time/plus/99/ 

Non-ASCII character '\xc3' in file 
/home/david/Documents/Django/tutorial2/base1/base1/views.py on line 8, but no 
encoding declared; see http://www.python.org/peps/pep-0263.html for details 
(views.py, line 8)

 Request Method: GET  Request URL: http://127.0.0.1:8000/time/plus/99/  Django 
Version: 1.5.5  Exception Type: SyntaxError  Exception Value: 

Non-ASCII character '\xc3' in file 
/home/david/Documents/Django/tutorial2/base1/base1/views.py on line 8, but no 
encoding declared; see http://www.python.org/peps/pep-0263.html for details 
(views.py, line 8)

 Exception Location: /home/david/Documents/Django/tutorial2/base1/base1/urls.py 
in , line 2  Python Executable: /usr/bin/python  Python Version: 
2.7.5  Python Path: 

['/home/david/Documents/Django/tutorial2/base1',
 '/usr/lib/python27.zip',
 '/usr/lib64/python2.7',
 '/usr/lib64/python2.7/plat-linux2',
 '/usr/lib64/python2.7/lib-tk',
 '/usr/lib64/python2.7/lib-old',
 '/usr/lib64/python2.7/lib-dynload',
 '/usr/lib64/python2.7/site-packages',
 '/usr/lib64/python2.7/site-packages/PIL',
 '/usr/local/lib64/python2.7/site-packages',
 '/usr/local/lib/python2.7/site-packages',
 '/usr/lib64/python2.7/site-packages/gtk-2.0',
 '/usr/lib/python2.7/site-packages',
 '/usr/lib64/python2.7/site-packages/wx-2.8-gtk2-unicode']

 Server time: Tue, 14 Jan 2014 12:12:55 -0600
The code whituot 'á'-->a

from django.http import Http404, HttpResponse
import datetime
# coding: utf-8

def hello(request):
return HttpResponse("Hello world")
def home_page(request):
return HttpResponse("Pagina de Inicio")
..
.
.
It's work



El martes, 14 de enero de 2014 13:21:20 UTC-3, Erik Cederstrand escribió:
>
> Den 14/01/2014 kl. 17.04 skrev David Pineda >: 
>
>
> > Hello, i'm beginning to learn python+django and i'm doing that handbook 
> https://github.com/jacobian/djangobook.com/blob/master/chapter03.rst 
> > In the example whit datetime i have a problem when i active the utf-8 
> encondig because i use á,ñ, etc (i'm chilean and we talk in spanish) 
> > So, when i deactive it's works fine, but in the future when i do 
> something more i will need the utf8 enconding and all functionalities like 
> datetime working and i don't know  yet how to do to make work together 
> that, 
>
> Please post the code where you are trying to use non-ASCII characters. 
> What did you try, and what is the exact error message you see? 
>
> Thanks, 
> Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/67d88b83-2be9-4295-93f5-c285f760736c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Extends template and receive 'IsADirectoryError'

2016-12-08 Thread David Pineda
Hello guys.

I have a template inside app, and the base template in files/templates 
folder.

This is the dir tree :

.
├── apps
│   └── user_profile
│   ├── migrations
│   ├── __pycache__
│   └── templates
├── broker
│   ├── __pycache__
│   └── settings
│   └── __pycache__
└── files
├── components
├── media
├── static
│   ├── admin
│   ├── admin_tools
│   ├── ckeditor
│   ├── css
│   ├── django_extensions
│   ├── js
│   └── semantic
└── templates

And then, usually the extends in app template from base.html it's works but 
now appeard the directory error. (Python 3.5.2 and Django 1.10.4)

So, i followed the documentation but it didn't work yet. 
 
Can you help me?

Thanks!


Traceback:

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/en/success/

Django Version: 1.10.4
Python Version: 3.5.1
Installed Applications:
['admin_tools',
 'admin_tools.theming',
 'admin_tools.menu',
 'admin_tools.dashboard',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'ckeditor',
 'ckeditor_uploader',
 'django_bleach',
 'django_mathjax',
 'djangobower',
 'django_extensions',
 'compressor',
 'imagekit',
 'user_profile']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']


Template error:
In template 
/home/david/Proyectos/secure_broker/site/broker/apps/user_profile/templates/client_profile/success.html,
 
error at line 0
   21   1 : {% extends "base.html" %}
   2 : {% block main%}
   3 :  Registro Exitoso.
   4 : 
   5 : Ahora puede ingresar al sitio como un usuario registrado.
   6 : 
   7 :  ¡Muchas Gracias!
   8 : {% endblock main %}
   9 : 

Traceback:

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/core/handlers/exception.py"
 
in inner
  39. response = get_response(request)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/core/handlers/base.py"
 
in _get_response
  217. response = self.process_exception_by_middleware(e, 
request)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/core/handlers/base.py"
 
in _get_response
  215. response = response.render()

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/response.py"
 
in render
  109. self.content = self.rendered_content

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/response.py"
 
in rendered_content
  86. content = template.render(context, self._request)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/backends/django.py"
 
in render
  66. return self.template.render(context)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/base.py"
 
in render
  208. return self._render(context)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/base.py"
 
in _render
  199. return self.nodelist.render(context)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/base.py"
 
in render
  994. bit = node.render_annotated(context)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/base.py"
 
in render_annotated
  961. return self.render(context)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/loader_tags.py"
 
in render
  174. return compiled_parent._render(context)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/base.py"
 
in _render
  199. return self.nodelist.render(context)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/base.py"
 
in render
  994. bit = node.render_annotated(context)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/base.py"
 
in render_annotated
  961. return self.render(context)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/loader_tags.py"
 
in render
  201. template = 
context.template.engine.get_template(template_name)

File 
"/home/david/.virtualenvs/securebroker/lib/python3.5/site-packages/django/template/engine.py"
 
in get_template
  160. template, origin = self.find

Django + Ckeditor

2016-01-02 Thread David Pineda
Hello folks! Happy new year!

I have a question about ckeditor on django. I configured ok and use
ckeditor field on my project model. But when i show the content on a
template view, the images only show the [img] tag and the path to file. I
think it can be a filter but on the official site there are nothing about
how to show on a view the field (only how to enable on the edit form).
So i ask you about this, how to do the correct configuration to show the
field with images (not qith tag img)

Thanks!

-- 
David A. Pineda Osorio
F:+56 9 82142267
Ingeniero Civil Electricista
Universidad de Chile

*http://www.cultura-libre.cl/ *

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAn3imxDoToELcxo%2B12pQQ0eX2d0ye%2Bj25Jv%3DqTa1WcoYq17aQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Script para automatizar herramientas de desarrollo (automate-dev-tools)

2016-03-21 Thread David Pineda
Comparto script de bash qoue les permitirá automatizar las herramientas de
desarrollo de django,

https://gist.github.com/dpineiden/4c4a20a9cf0eabbe1754

Se ejecuta:

source ~/automate_Django_dev.sh -f="PROJECT_FOLDER" -p='project' -s -g -rp
-d

Corre:

-shell
-server
-gulp
-git
-sphinx-autodocument
-django-extensions {shell,runserver}_plus

-- 
David A. Pineda Osorio
F:+56 9 82142267
Ingeniero Civil Electricista
Universidad de Chile

*http://www.cultura-libre.cl/ *

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAn3imz7ByCm3qY4_nqra%2BzW8QUEHDugU-qL4rAVYKcMP4%3D0pQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.