Re: Trying to upgrade Django using pip on CentOS results in segmentation fault

2016-02-17 Thread Tanuka Dutta
Thanks for the suggestions. I had stopped Apache, and I also tried a fresh 
install in a new virtualenv. 

That actually helped me discover the root cause of the problem because I 
got a different traceback during a fresh install. Pasting it here in case 
others run into the same problem someday:

(syt_env)[syt_admin@VM1 vishwaas]$pip2.7 install -r 
requirements/production.txt

Collecting Django==1.8.8 (from -r requirements/base.txt (line 1))
Exception:
Traceback (most recent call last):
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/basecommand.py",
 
line 211, in main
status = self.run(options, args)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/commands/install.py",
 
line 305, in run
wb.build(autobuilding=True)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/wheel.py",
 
line 705, in build
self.requirement_set.prepare_files(self.finder)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/req/req_set.py",
 
line 334, in prepare_files
functools.partial(self._prepare_file, finder))
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/req/req_set.py",
 
line 321, in _walk_req_to_install
more_reqs = handler(req_to_install)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/req/req_set.py",
 
line 461, in _prepare_file
req_to_install.populate_link(finder, self.upgrade)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/req/req_install.py",
 
line 250, in populate_link
self.link = finder.find_requirement(self, upgrade)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/index.py",
 
line 486, in find_requirement
all_versions = self._find_all_versions(req.name)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/index.py",
 
line 404, in _find_all_versions
index_locations = self._get_index_urls_locations(project_name)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/index.py",
 
line 378, in _get_index_urls_locations
page = self._get_page(main_index_url)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/index.py",
 
line 818, in _get_page
return HTMLPage.get_page(link, session=self.session)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/index.py",
 
line 928, in get_page
"Cache-Control": "max-age=600",
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py",
 
line 477, in get
return self.request('GET', url, **kwargs)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/download.py",
 
line 373, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py",
 
line 465, in request
resp = self.send(prep, **send_kwargs)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py",
 
line 573, in send
r = adapter.send(request, **kwargs)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py",
 
line 36, in send
cached_response = self.controller.cached_request(request)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py",
 
line 102, in cached_request
resp = self.serializer.loads(request, self.cache.get(cache_url))
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py",
 
line 108, in loads
return getattr(self, "_loads_v{0}".format(ver))(request, data)
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py",
 
line 170, in _loads_v2
cached["response"]["body"]
  File 
"/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py",
 
line 20, in _b64_decode_bytes
return base64.b64decode(b.encode("ascii"))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 
0-2662: ordinal not in range(128)


It turned out to be a known issue with pip version 7.1.2. I need to upgrade 
to the latest pip version 8.0.2

https://github.com/pypa/pip/issues/2674
https://github.com/pypa/pip/issues/3245

Meanwhile, the workaround is to use the option --no-cache-dir

(syt_env)[syt_admin@VM1 vishwaas]$ pip2.7 install -r 
requirements/production.txt  --no-cache-dir

This worked fine, and I was able to upgrade the packages in my old 
virtualenv as well as do a fresh install in the new one.

Whew!!

Regards,
Tanuka


On Wednesday, 17 February 2016 22:09:03 UTC+5:30, ke1g wrote:
>
> Or clone into a 

Re: null datetime field and json fixtures

2016-02-17 Thread James Schneider
>
>
> Last night before posting I hacked serializers/python.py to make an
> exception for sunsetdate, and that apparently worked, but now I have this:
>

Yeah...don't do that. Fix your data.


> File
> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py",
> line 2390, in get_db_prep_value
>
>  value = uuid.UUID(value)
>
>  File "/usr/lib/python2.7/uuid.py", line 134, in __init__
>
>  raise ValueError('badly formed hexadecimal UUID string')
>
> ValueError: Problem installing fixture
> '/home/malikarumi/Projects/cannon/jamf/essell/fixtures/test22byhand.json':
> badly formed hexadecimal UUID string
>
> The only uuid currently in this fixture is the one I got from Django when
> I put another model (only one row) in with a fixture (no date field) and it
> worked. I needed the uuid of that object to put into the foreign key of the
> model I am having trouble with now.
>

The uuid.UUID() function is somewhat forgiving when it comes to providing
values. See https://docs.python.org/3.5/library/uuid.html. Does the UUID in
your JSON data match any of those formats? The only common format for a
UUID that I've seen that doesn't match any of those formats would be
'----' which is a string that contains
dashes, but no surrounding braces. I believe that's the format that is
pulled when using UUID's from Django installations by default. I'm actually
surprised the Python UUID library doesn't support it, but maybe it's one of
those RFC things that specifies the formats that must be accepted.


> Finally, this morning after reading your responses I decided to try
> putting in null with no comma, since I had already tried it with no quotes,
> and of course that didn't work. But then in fooling with it I put null in
> right next to the colon, with no spaces or quotes, followed by a comma, and
> this time null turned blue in my code editor, which suggests it was
> working. But then I got the 'badly formed hexadecimal UUID string error
> again.
>

JSON has rules for how data should be formatted. You may want to look those
up for guidelines.

> In sum, there is a special syntax to using null which is not obvious, but
> thanks for making me take another look and try again. The uuid error seems
> to be something else. There is a bugfix on github from November of 2014, so
> I don't (yet) know why I'm having this issue. I may post that later as a
> separate question. Thanks again!
>
>
Out of curiosity, did you generate the JSON manually, or did you use a
library (like the built-in JSON library in Python) to create the data dump
for you? From the sound of it, either you've mucked with it a bunch
yourself (which almost always leads to these types of issues with JSON), or
it was generated manually to look like JSON. Any proven serializer library
likely wouldn't generate data that resulted in the errors that you are
seeing (at least as far as the null issue is concerned). It would be
possible to get a 'malformed' UUID, since the serializer may not have been
configured correctly or aware of the intended format for the UUID values,
but would still have generated valid JSON.

-James

-- 
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/CA%2Be%2BciVMREomNdie_ffKS619roWsZ5qHzAxKC1JDSST2U5RKRQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error(after updating to django 1.9

2016-02-17 Thread James Schneider
On Wed, Feb 17, 2016 at 8:34 AM, Deepak Gupta 
wrote:

>
> I am trying to create a project
> CommandError: /home/shaastr/bnms/manage.py already exists, overlaying a
> project or app into an existing directory won't replace conflicting files
>

Are you trying to create a project with the same name in the same location?
You'll need to either delete/move the existing project, or pick a new
name/location for your new project.

If you are just trying to update Django itself, but keep the same project
files, then there's no need to start a new project. You'll just update the
code in your existing project to work with Django 1.9 after updating your
Django installation (usually through pip).

-James

-- 
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/CA%2Be%2BciXEWAYVCZNkDSuUaZ-%2BxEZNiMd8Q7Vw7ysn2J4rLR2BAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Missing button image

2016-02-17 Thread James Schneider
On Wed, Feb 17, 2016 at 3:03 PM, WST  wrote:

> Hi All,
>
>
> I would appreciate if someone could tell me why the view components will
> not load? Thank you!
>

Without more information, there's no way to tell. It's likely that you are
not correctly serving your static files. Are you running the Django dev
server or is this running under something like Apache or Nginx?

You are probably seeing HTTP 404 errors in your console output if you are
using the Django dev console. See this link for making sure your static
files are served correctly in this instance:
https://docs.djangoproject.com/en/1.9/howto/static-files/

-James

-- 
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/CA%2Be%2BciXG%3Dk2vGT4Lx8hZ2s%3DTYZu34G30M3HBFTK-FT9Zt1FRqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Missing button image

2016-02-17 Thread Nikolas Stevenson-Molnar
More information would be helpful here. Where are the missing images being 
loaded from? Are they static files related to your project? Are they static 
files hosted elsewhere? Are they images dynamically generated by a view? Do 
the images ever display correctly? (e.g., do they display in development 
but not production)?

_Nik

On Wednesday, February 17, 2016 at 3:03:06 PM UTC-8, WST wrote:
>
> Hi All,
>
>
> I would appreciate if someone could tell me why the view components will 
> not load? Thank you!
>
>
>
> 
>
>
>

-- 
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/5cf2e192-b1fb-44d3-a3b8-a23a5877b8ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: var1 = var2 = var3

2016-02-17 Thread Nikolas Stevenson-Molnar
The term is "chained assignment" (applied to other languages as well).

https://en.wikipedia.org/wiki/Assignment_(computer_science)#Chained_assignment

_Nik

On Tuesday, February 16, 2016 at 12:06:10 PM UTC-8, anotherdjangonewby 
wrote:
>
> Hi, 
>
> this may be a bit off-topic, but: 
>
> How are expressions like: 
>
> var1 = var2 = var3 
>
> called Python. Without a hint I cannot goolge this. 
>
> Thanks 
>
> Kai 
>

-- 
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/8c0392e7-a040-4d53-8e40-96aed5a41176%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Missing button image

2016-02-17 Thread WST


Hi All,


I would appreciate if someone could tell me why the view components will 
not load? Thank you!





-- 
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/6ff6203f-985d-4d4e-b390-ea5876768b50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Learning Django resources

2016-02-17 Thread Robert Dumitru
Thank you so much! I think I'll go with the official tutorial

miercuri, 17 februarie 2016, 18:54:17 UTC+2, Robert Dumitru a scris:
>
> Hi! Is there any "complete" resource I could use for learning Django, 
> other than "The Django Book"? *I do not like video tutorials*
>

-- 
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/70d73d5a-e571-47a4-b34f-08fa9fa673ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Declare REST clients in django project

2016-02-17 Thread Горобец Дмитрий
Hello!

How do you declare different REST clients in settings of django project?

Is it a right way to declare clients directly in settings.py?
MAILCHIMP_CLIENT = mailchimp.Mailchimp(MAILCHIMP_API_KEY)
TWILIO_CLIENT = TwilioRestClient(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)


-- 
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/1a5f128a-36a2-46f1-96ea-56f915cda8a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: M2M: How to order by a field from the `through` table?

2016-02-17 Thread 'Brutus Schraiber' via Django users


Am Dienstag, 16. Februar 2016 10:00:43 UTC+1 schrieb Brutus Schraiber:
>
> Any hints on how to archive this (prefetch + ordering on `trough` table)?
>

Prefetch(
  'notes',
  Note.objects.order_by('pinboard_pins__position'),
) 


-- 
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/5e413eab-98ff-46fe-a385-68782a82c602%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Learning Django resources

2016-02-17 Thread Andrew Pinkham
Hi Robert,
You may be interested in my response to this question in another thread:

https://groups.google.com/d/msg/django-users/-iTZB7K1QI4/TTVXd9Y6EwAJ

Hope that helps,
Andrew

-- 
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/FB38E03C-DE51-4E9D-992F-3F20F1BB9466%40andrewsforge.com.
For more options, visit https://groups.google.com/d/optout.


Error(after updating to django 1.9

2016-02-17 Thread Deepak Gupta

I am trying to create a project
CommandError: /home/shaastr/bnms/manage.py already exists, overlaying a 
project or app into an existing directory won't replace conflicting files

-- 
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/bd15a19b-8cc8-4de3-a231-4a8e3c98a7e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Show error messages with verbose field names instead field names

2016-02-17 Thread Francisco Lopes
Hi,

I'm creating an update form. I want to show error messages using verbose 
field names instead field names itself. 

Source code:

http://dpaste.com/3DC214G

http://dpaste.com/2TB8SCD

When, for example, I leave the field 'estado_civil' empty, the message is 
'estado_civil: this field is required'. 

But i want to show this message using verbose name, like this: 'Estado Civil: 
this field is required'.

How can i do this?

Thanks.

-- 
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/8ce4fe4c-a5ac-464d-811d-b1ea3ee0bc30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Learning Django resources

2016-02-17 Thread Robert Dumitru
Hi! Is there any "complete" resource I could use for learning Django, other 
than "The Django Book"? *I do not like video tutorials*

-- 
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/a3099739-0379-4bb7-9e52-637a4a60390f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trying to upgrade Django using pip on CentOS results in segmentation fault

2016-02-17 Thread Bill Freeman
Or clone into a new virtualenv (you are using virtualenv, aren't you, and
you are using requires.txt and pip, and your code is in revision control,
right?), then change the Apache configuration to use the new VE and restart.

On Wed, Feb 17, 2016 at 7:00 AM, Mike Dewhirst 
wrote:

> Try stopping Apache during the upgrade. I need to do that on Ubuntu.
>
> Good luck
>
> *Connected by Motorola*
>
>
> Tanuka Dutta  wrote:
>
>
>
>
> down votefavorite
> 
>
> Hello,
>
> I have a Linux CentOS 6.7 installation on a VM. A few months ago, I had -
> compiled and installed Python 2.7.8 on it - installed virtualenv-13.1.2 in
> /usr/lib/python2.7/site-packages - installed Django 1.7 inside the
> virtualenv. - compiled and installed mod_wsgi 4.4.21 and used it to deploy
> Django on Apache
>
> I have been using this over the last few months with no issues.
>
> I am now trying to upgrade to Django 1.8.8. I activated the virtualenv and
> then executed the following command, but it encounters a segmentation fault
> each time.
>
> $pip2.7 install --upgrade django==1.8.8
> Collecting django==1.8.8
> /home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/sitepackages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90:
>  InsecurePlatformWarning: A true SSLContext object is not available. This 
> prevents urllib3 from configuring SSL appropriately and may cause certain SSL 
> connections to fail. For more information, see 
> https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.InsecurePlatformWarningDownloading
>  Django-1.8.8-py2.py3-none-any.whl (6.2MB)99% 
> |### | 6.2MB 9.1MB/s eta 0:00:01Segmentation fault
>
> If I preface the command with sudo, there is no segmentation fault, but it
> does not proceed to install the new version of Django at all.
>
> Output of verbose option given below
>
> pip2.7 install --upgrade django==1.8.8 -v
>
> Collecting django==1.8.8Getting page 
> https://pypi.python.org/simple/django/Starting new HTTPS connection (1): 
> pypi.python.org/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-  
>   packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: 
> InsecurePlatformWarning: A true SSLContext object is not available. This 
> prevents urllib3 from configuring SSL appropriately and may cause certain SSL 
> connections to fail. For more information, see 
> https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.InsecurePlatformWarning"GET
>  /simple/django/ HTTP/1.1" 200 39851 location(s) to search for versions of 
> django:* https://pypi.python.org/simple/django/Getting page 
> https://pypi.python.org/simple/django/"GET /simple/django/ HTTP/1.1" 200 
> 3985Analyzing links from page https://pypi.python.org/simple/django/Found 
> link 
> https://pypi.python.org/packages/any/D/Django/Django-1.5.2-py2.py3-none-any.whl#md5=07f0d2d42162945d0ad031fc9737847d
>  (from https://pypi.python.org/simple/django/), version: 1.5.2Found link 
> https://pypi.python.org/packages/any/D/Django/Django-1.5.8-py2.py3-none-any.whl#md5=1e3418bd1d6f9725a3d1264c9352f2a1
>  (from https://pypi.python.org/simple/django/), version: 1.5.8Found link 
> https://pypi.python.org/packages/any/D/Django/Django-1.6.1-py2.py3-none-any.whl#md5=c7b7a4437b36400f1c23953e9700fd29
>  (from https://pypi.python.org/simple/django/), version: 1.6.1Found link 
> https://pypi.python.org/packages/any/D/Django/Django-1.6.2-py2.py3-none-any.whl#md5=3bd014923e85df771b34d12c0ab3c9e1
>  (from https://pypi.python.org/simple/django/), version: 1.6.2Found link 
> https://pypi.python.org/packages/any/D/Django/Django-1.6.5-py2.py3-none-any.whl#md5=2bcdb4729f9f358b0925b532eef0a8ff
>  (from https://pypi.python.org/simple/django/), version: 
> 1.6.5..Found link 
> https://pypi.python.org/packages/source/D/Django/Django-1.8.8.tar.gz#md5=08ecf83b7e9d064ed7e3981ddc3a8a15
>  (from https://pypi.python.org/simple/django/), version: 1.8.8Found link 
> https://pypi.python.org/packages/source/D/Django/Django-1.8.9.tar.gz#md5=49f6863b1c83825fb2f473c141c28e15
>  (from https://pypi.python.org/simple/django/), version: 1.8.9Found link 
> https://pypi.python.org/packages/source/D/Django/Django-1.8.tar.gz#md5=9a811faf67ca0f3e0d43e670a1cc503d
>  (from https://pypi.python.org/simple/django/), version: 1.8Found link 
> https://pypi.python.org/packages/source/D/Django/Django-1.9.1.tar.gz#md5=02754aa2d5c9c171dfc3f9422b20e12c
>  (from https://pypi.python.org/simple/django/), version: 1.9.1Found link 
> https://pypi.python.org/packages/source/D/Django/Django-1.9.2.tar.gz#md5=ee90280973d435a1a6aa01b453b50cd1
>  (from https://pypi.python.org/simple/django/), version: 1.9.2Found link 
> https://pypi.python.org/packages/source/D/Django/Django-1.9.tar.gz#md5=110389cf89196334182295165852e082
>  (from 

Re: django: drop down menu not displaying on template despite correct syntax

2016-02-17 Thread jorrit787
Have you tried using just {{ form }} instead of {{ form.mismatch }} ?

Also, (not sure if this is related) in your MISMATCH_CHOICES tuple you are 
giving strings instead of integers for the key value. Try using (0, '0') 
instead of ('0','0')


On Tuesday, February 16, 2016 at 2:16:17 PM UTC+1, clarkso...@gmail.com 
wrote:
>
> I have successfully configured a way to upload files to a website that I 
> am making. However we would like to include a drop-down menu on the site. 
> However, we want to include in the form of a drop-down menu called 
> "mismatch choice":
>
>
> models.py: for drop-down menu
>
>  class Mismatches(models.Model):
>
>   MISMATCH_CHOICES = (
>
>('0', '0'),
>
>('1', '1'),
>
>('2', '2'),
>
>('3', '3'),
>
>)
>
>   mismatch = models.IntegerField(max_length=1, default='0', 
> choices = MISMATCH_CHOICES)
>
>
> forms.py for drop-down menu:
>
>   class MismatchesForm(ModelForm): #unsure how to reference a 
> class in our in-app-urls.py
>
> class Meta:
>
> model = Mismatches
>
> fields = ['mismatch']
>
> 'model=Mismatches' links to the Mismatches class in models and the 'field' 
> gives the options.
>
>
> views.py for drop-down menu
>
>  class Mismatch_Choice(FormView):
>
>template_name = 'list.html'
>
>form_class = MismatchesForm
>
>
>
> "template_name = 'list.html'" links the html page called list.html. 
> 'form_class' links to the form 'MismatchesForm'.
>
> html for drop-down menu
>
> {% csrf_token %}
>
>   {{ form.mismatch }}
>
>   
>
> 
>
>
> We used a tutorial as a template for our code but it won't display on our 
> html page even though we have referenced it with {{ form.mismatch}} which 
> links to the variable 'mismatch' which is set in our form as the 'model' 
> and hence links to the options given in models.py. 
>
> We are wondering if the html page is not seeing the drop-down menu because 
> it's set as a class in the forms.py but we haven't referenced a class in 
> our in-app urls.py (is there a way to do this?)...
>
> NOTE: all migrations were accordingly applied and the server was restarted 
> multiple times
>

-- 
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/dab775e8-7d3a-4140-b9ed-f4b16cef8b35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: null datetime field and json fixtures

2016-02-17 Thread Malik Rumi
First, thank you to both Avraham and James. In my view, it isn't said often
enough on the internet, and I've had many questions go without a response
at all. So please understand that I mean it very much when I say I deeply
appreciate the time you took to help me.

Now as to the matter at hand: The field in question is 'sunsetdate',
referring to the date something ends. It must be optional since most of my
objects/data don't, or haven't, ended. The first time I tried this I had
the empty string, '', in all rows in that column.

(cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ python manage.py
loaddata essell/fixtures/test22byhand.json

Traceback (most recent call last):

File
"/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/serializers/python.py",
line 174, in Deserializer

 raise base.DeserializationError.WithData(e, d['model'],
d.get('pk'), field_value)

django.core.serializers.base.DeserializationError: Problem installing
fixture
'/home/malikarumi/Projects/cannon/jamf/essell/fixtures/test22byhand.json':
[u"'' value has an invalid date format. It must be in -MM-DD format."]:
(essell.Code:pk=None) field_value was ''

I replaced “”, - the empty string - with ',', that is, nothing, no string,
no quote, nothing but the comma

File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode

raise ValueError("No JSON object could be decoded")

django.core.serializers.base.DeserializationError: Problem installing
fixture
'/home/malikarumi/Projects/cannon/jamf/essell/fixtures/test22byhand.json':
No JSON object could be decoded

So now I assume this is because there are no quotes on sunsetdate. Note how
that one error in that one field makes the whole document 'not json'.

Now I have to put the date in the way they want it, which is not what I
want but not the end of the world since I don't have to display this field
if there is no actual sunset date.

File
"/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/serializers/python.py",
line 174, in Deserializer

 raise base.DeserializationError.WithData(e, d['model'],
d.get('pk'), field_value)

django.core.serializers.base.DeserializationError: Problem installing
fixture
'/home/malikarumi/Projects/cannon/jamf/essell/fixtures/test22byhand.json':
[u"'null' value has an invalid date format. It must be in -MM-DD
format."]: (essell.Code:pk=None) field_value was 'null'

django.core.serializers.base.DeserializationError: Problem installing
fixture
'/home/malikarumi/Projects/cannon/jamf/essell/fixtures/test22byhand.json':
[u"'-00-00' value has the correct format (-MM-DD) but it is an
invalid date."]: (essell.Code:pk=None) field_value was '-00-00'

Last night before posting I hacked serializers/python.py to make an
exception for sunsetdate, and that apparently worked, but now I have this:

File
"/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py",
line 2390, in get_db_prep_value

 value = uuid.UUID(value)

 File "/usr/lib/python2.7/uuid.py", line 134, in __init__

 raise ValueError('badly formed hexadecimal UUID string')

ValueError: Problem installing fixture
'/home/malikarumi/Projects/cannon/jamf/essell/fixtures/test22byhand.json':
badly formed hexadecimal UUID string

The only uuid currently in this fixture is the one I got from Django when I
put another model (only one row) in with a fixture (no date field) and it
worked. I needed the uuid of that object to put into the foreign key of the
model I am having trouble with now.

Finally, this morning after reading your responses I decided to try putting
in null with no comma, since I had already tried it with no quotes, and of
course that didn't work. But then in fooling with it I put null in right
next to the colon, with no spaces or quotes, followed by a comma, and this
time null turned blue in my code editor, which suggests it was working. But
then I got the 'badly formed hexadecimal UUID string error again.

In sum, there is a special syntax to using null which is not obvious, but
thanks for making me take another look and try again. The uuid error seems
to be something else. There is a bugfix on github from November of 2014, so
I don't (yet) know why I'm having this issue. I may post that later as a
separate question. Thanks again!

On Wed, Feb 17, 2016 at 3:51 AM, James Schneider 
wrote:

>
>
> On Tue, Feb 16, 2016 at 4:35 PM, Malik Rumi 
> wrote:
>
>> There are a ton of answers to this question out there - if you can wade
>> through all the ones that refer to forms and not models. The consensus
>> seems to be that datetime has to be set to both blank=true and null=true.
>> And when I put in one test row of data manually through the admin, I could
>> leave my datetime field blank with no problems. But when I tried to load
>> the 89 other instances through a fixture, I got error 

creating temporary storage file in django-media from drop down input

2016-02-17 Thread clarksonchris81


I have managed to configure a system, using django, that allows me to 
upload a file to my media-folder. I have (using simple-html) included a 
drop-down menu that will specify parameters that will be considered when 
processing the uploaded file in a pipeline.



{% csrf_token %}
{{ form.non_field_errors }}

{{ form.docfile.label_tag }} {{ form.docfile.help_text }}


{{ form.docfile.errors }}
{{ form.docfile }}




Genome Dataset
 
  
All
Neanderthal
hg38 Human
Denisovan
  
   



I need to send the selected dropdown option to a text file. and I have 
attempted to do so as follows in views.py. However. while the file uploads 
to the media folder successfully, no text file manifests in the media 
folder- which is needed.

def GenomesView(request):
   if request.method == 'GET':
 getgen = request.GET.get('genome')
 content = ContentFile(getgen)
 f = open(os.path.join(settings.MEDIA_ROOT, 'file.txt'), 'w')
 myfile = File(f)
 myfile.write(getgen)
 myfile.close()

The location of the media folder is as below in settings.

  MEDIA_URL = '/media/'
  MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

Hence my question is how do I take the selected option forms the drop-down 
and each time the file is uploaded to the site, the selection is sent to 
text file that will be over-written for each new submission (acting as a 
temporary storage for the selected option parameter i.e "Neanderthall" etc. 
as seen in code above)?


We have also tested the "tempfile" module with a generic command to create 
a temporary file within the app directory:

>>> with TemporaryFile() as f:
  f.write('abcdefg')
  f.seek(0)  # go back to the beginning
  print(f.read())


abcdefg

But this does not work either

-- 
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/c81aed6c-a59a-452d-adad-2877b316e250%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trying to upgrade Django using pip on CentOS results in segmentation fault

2016-02-17 Thread Mike Dewhirst
Try stopping Apache during the upgrade. I need to do that on Ubuntu. 

Good luck

Connected by Motorola

Tanuka Dutta  wrote:

>
>
>
>
>down votefavorite
>
>Hello,
>
>I have a Linux CentOS 6.7 installation on a VM. A few months ago, I had - 
>compiled and installed Python 2.7.8 on it - installed virtualenv-13.1.2 in 
>/usr/lib/python2.7/site-packages - installed Django 1.7 inside the virtualenv. 
>- compiled and installed mod_wsgi 4.4.21 and used it to deploy Django on Apache
>
>I have been using this over the last few months with no issues.
>
>I am now trying to upgrade to Django 1.8.8. I activated the virtualenv and 
>then executed the following command, but it encounters a segmentation fault 
>each time.
>
>$pip2.7 install --upgrade django==1.8.8 Collecting django==1.8.8 
>/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/sitepackages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90:
> InsecurePlatformWarning: A true SSLContext object is not available. This 
>prevents urllib3 from configuring SSL appropriately and may cause certain SSL 
>connections to fail. For more information, see 
>https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
> InsecurePlatformWarning Downloading Django-1.8.8-py2.py3-none-any.whl (6.2MB) 
>99% |### | 6.2MB 9.1MB/s eta 0:00:01Segmentation 
>fault
>
>If I preface the command with sudo, there is no segmentation fault, but it 
>does not proceed to install the new version of Django at all.
>
>Output of verbose option given below 
>
>pip2.7 install --upgrade django==1.8.8 -v
>
>
>Collecting django==1.8.8 Getting page https://pypi.python.org/simple/django/ 
>Starting new HTTPS connection (1): pypi.python.org 
>/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site- 
>packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: 
>InsecurePlatformWarning: A true SSLContext object is not available. This 
>prevents urllib3 from configuring SSL appropriately and may cause certain SSL 
>connections to fail. For more information, see 
>https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
> InsecurePlatformWarning "GET /simple/django/ HTTP/1.1" 200 3985 1 location(s) 
>to search for versions of django: * https://pypi.python.org/simple/django/ 
>Getting page https://pypi.python.org/simple/django/ "GET /simple/django/ 
>HTTP/1.1" 200 3985 Analyzing links from page 
>https://pypi.python.org/simple/django/ Found link 
>https://pypi.python.org/packages/any/D/Django/Django-1.5.2-py2.py3-none-any.whl#md5=07f0d2d42162945d0ad031fc9737847d
> (from https://pypi.python.org/simple/django/), version: 1.5.2 Found link 
>https://pypi.python.org/packages/any/D/Django/Django-1.5.8-py2.py3-none-any.whl#md5=1e3418bd1d6f9725a3d1264c9352f2a1
> (from https://pypi.python.org/simple/django/), version: 1.5.8 Found link 
>https://pypi.python.org/packages/any/D/Django/Django-1.6.1-py2.py3-none-any.whl#md5=c7b7a4437b36400f1c23953e9700fd29
> (from https://pypi.python.org/simple/django/), version: 1.6.1 Found link 
>https://pypi.python.org/packages/any/D/Django/Django-1.6.2-py2.py3-none-any.whl#md5=3bd014923e85df771b34d12c0ab3c9e1
> (from https://pypi.python.org/simple/django/), version: 1.6.2 Found link 
>https://pypi.python.org/packages/any/D/Django/Django-1.6.5-py2.py3-none-any.whl#md5=2bcdb4729f9f358b0925b532eef0a8ff
> (from https://pypi.python.org/simple/django/), version: 1.6.5 
>.. Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.8.8.tar.gz#md5=08ecf83b7e9d064ed7e3981ddc3a8a15
> (from https://pypi.python.org/simple/django/), version: 1.8.8 Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.8.9.tar.gz#md5=49f6863b1c83825fb2f473c141c28e15
> (from https://pypi.python.org/simple/django/), version: 1.8.9 Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.8.tar.gz#md5=9a811faf67ca0f3e0d43e670a1cc503d
> (from https://pypi.python.org/simple/django/), version: 1.8 Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.9.1.tar.gz#md5=02754aa2d5c9c171dfc3f9422b20e12c
> (from https://pypi.python.org/simple/django/), version: 1.9.1 Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.9.2.tar.gz#md5=ee90280973d435a1a6aa01b453b50cd1
> (from https://pypi.python.org/simple/django/), version: 1.9.2 Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.9.tar.gz#md5=110389cf89196334182295165852e082
> (from https://pypi.python.org/simple/django/), version: 1.9 Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.9rc1.tar.gz#md5=b971686521ea09b4bf82aec3e794fcbc
> (from https://pypi.python.org/simple/django/), version: 1.9rc1 Using version 
>1.8.8 (newest of versions: 1.8.8, 1.8.8) "GET 
>/packages/py2.py3/D/Django/Django-1.8.8-py2.py3-none-any.whl HTTP/1.1" 200 
>6170205 Downloading Django-1.8.8-py2.py3-none-any.whl (6.2MB) Downloading from 
>URL 

Re: Trying to upgrade Django using pip on CentOS results in segmentation fault

2016-02-17 Thread Mike Dewhirst
Try sto

Connected by Motorola

Tanuka Dutta  wrote:

>
>
>
>
>down votefavorite
>
>Hello,
>
>I have a Linux CentOS 6.7 installation on a VM. A few months ago, I had - 
>compiled and installed Python 2.7.8 on it - installed virtualenv-13.1.2 in 
>/usr/lib/python2.7/site-packages - installed Django 1.7 inside the virtualenv. 
>- compiled and installed mod_wsgi 4.4.21 and used it to deploy Django on Apache
>
>I have been using this over the last few months with no issues.
>
>I am now trying to upgrade to Django 1.8.8. I activated the virtualenv and 
>then executed the following command, but it encounters a segmentation fault 
>each time.
>
>$pip2.7 install --upgrade django==1.8.8 Collecting django==1.8.8 
>/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/sitepackages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90:
> InsecurePlatformWarning: A true SSLContext object is not available. This 
>prevents urllib3 from configuring SSL appropriately and may cause certain SSL 
>connections to fail. For more information, see 
>https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
> InsecurePlatformWarning Downloading Django-1.8.8-py2.py3-none-any.whl (6.2MB) 
>99% |### | 6.2MB 9.1MB/s eta 0:00:01Segmentation 
>fault
>
>If I preface the command with sudo, there is no segmentation fault, but it 
>does not proceed to install the new version of Django at all.
>
>Output of verbose option given below 
>
>pip2.7 install --upgrade django==1.8.8 -v
>
>
>Collecting django==1.8.8 Getting page https://pypi.python.org/simple/django/ 
>Starting new HTTPS connection (1): pypi.python.org 
>/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site- 
>packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: 
>InsecurePlatformWarning: A true SSLContext object is not available. This 
>prevents urllib3 from configuring SSL appropriately and may cause certain SSL 
>connections to fail. For more information, see 
>https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
> InsecurePlatformWarning "GET /simple/django/ HTTP/1.1" 200 3985 1 location(s) 
>to search for versions of django: * https://pypi.python.org/simple/django/ 
>Getting page https://pypi.python.org/simple/django/ "GET /simple/django/ 
>HTTP/1.1" 200 3985 Analyzing links from page 
>https://pypi.python.org/simple/django/ Found link 
>https://pypi.python.org/packages/any/D/Django/Django-1.5.2-py2.py3-none-any.whl#md5=07f0d2d42162945d0ad031fc9737847d
> (from https://pypi.python.org/simple/django/), version: 1.5.2 Found link 
>https://pypi.python.org/packages/any/D/Django/Django-1.5.8-py2.py3-none-any.whl#md5=1e3418bd1d6f9725a3d1264c9352f2a1
> (from https://pypi.python.org/simple/django/), version: 1.5.8 Found link 
>https://pypi.python.org/packages/any/D/Django/Django-1.6.1-py2.py3-none-any.whl#md5=c7b7a4437b36400f1c23953e9700fd29
> (from https://pypi.python.org/simple/django/), version: 1.6.1 Found link 
>https://pypi.python.org/packages/any/D/Django/Django-1.6.2-py2.py3-none-any.whl#md5=3bd014923e85df771b34d12c0ab3c9e1
> (from https://pypi.python.org/simple/django/), version: 1.6.2 Found link 
>https://pypi.python.org/packages/any/D/Django/Django-1.6.5-py2.py3-none-any.whl#md5=2bcdb4729f9f358b0925b532eef0a8ff
> (from https://pypi.python.org/simple/django/), version: 1.6.5 
>.. Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.8.8.tar.gz#md5=08ecf83b7e9d064ed7e3981ddc3a8a15
> (from https://pypi.python.org/simple/django/), version: 1.8.8 Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.8.9.tar.gz#md5=49f6863b1c83825fb2f473c141c28e15
> (from https://pypi.python.org/simple/django/), version: 1.8.9 Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.8.tar.gz#md5=9a811faf67ca0f3e0d43e670a1cc503d
> (from https://pypi.python.org/simple/django/), version: 1.8 Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.9.1.tar.gz#md5=02754aa2d5c9c171dfc3f9422b20e12c
> (from https://pypi.python.org/simple/django/), version: 1.9.1 Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.9.2.tar.gz#md5=ee90280973d435a1a6aa01b453b50cd1
> (from https://pypi.python.org/simple/django/), version: 1.9.2 Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.9.tar.gz#md5=110389cf89196334182295165852e082
> (from https://pypi.python.org/simple/django/), version: 1.9 Found link 
>https://pypi.python.org/packages/source/D/Django/Django-1.9rc1.tar.gz#md5=b971686521ea09b4bf82aec3e794fcbc
> (from https://pypi.python.org/simple/django/), version: 1.9rc1 Using version 
>1.8.8 (newest of versions: 1.8.8, 1.8.8) "GET 
>/packages/py2.py3/D/Django/Django-1.8.8-py2.py3-none-any.whl HTTP/1.1" 200 
>6170205 Downloading Django-1.8.8-py2.py3-none-any.whl (6.2MB) Downloading from 
>URL 

- Broken pipe from ('127.0.0.1', 50977) When doing POST calls from the Ajax code residing the same server for Django application

2016-02-17 Thread sairam . bandaru09
Hi,

I am getting this error

[15/Feb/2016 01:38:58] "POST /api/survey/updateSurveyTitle/ HTTP/1.1" 200 44
- Broken pipe from ('127.0.0.1', 50977)

Please help out


Thanks

-- 
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/3a289810-143c-4403-9bb1-3a257725de1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Trying to upgrade Django using pip on CentOS results in segmentation fault

2016-02-17 Thread Tanuka Dutta



down votefavorite 


Hello,

I have a Linux CentOS 6.7 installation on a VM. A few months ago, I had - 
compiled and installed Python 2.7.8 on it - installed virtualenv-13.1.2 in 
/usr/lib/python2.7/site-packages - installed Django 1.7 inside the 
virtualenv. - compiled and installed mod_wsgi 4.4.21 and used it to deploy 
Django on Apache

I have been using this over the last few months with no issues.

I am now trying to upgrade to Django 1.8.8. I activated the virtualenv and 
then executed the following command, but it encounters a segmentation fault 
each time.

$pip2.7 install --upgrade django==1.8.8
Collecting django==1.8.8
/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/sitepackages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90:
 InsecurePlatformWarning: A true SSLContext object is not available. This 
prevents urllib3 from configuring SSL appropriately and may cause certain SSL 
connections to fail. For more information, see 
https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.InsecurePlatformWarningDownloading
 Django-1.8.8-py2.py3-none-any.whl (6.2MB)99% |### 
| 6.2MB 9.1MB/s eta 0:00:01Segmentation fault

If I preface the command with sudo, there is no segmentation fault, but it 
does not proceed to install the new version of Django at all.

Output of verbose option given below 

pip2.7 install --upgrade django==1.8.8 -v

Collecting django==1.8.8Getting page 
https://pypi.python.org/simple/django/Starting new HTTPS connection (1): 
pypi.python.org/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-
packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: 
InsecurePlatformWarning: A true SSLContext object is not available. This 
prevents urllib3 from configuring SSL appropriately and may cause certain SSL 
connections to fail. For more information, see 
https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.InsecurePlatformWarning"GET
 /simple/django/ HTTP/1.1" 200 39851 location(s) to search for versions of 
django:* https://pypi.python.org/simple/django/Getting page 
https://pypi.python.org/simple/django/"GET /simple/django/ HTTP/1.1" 200 
3985Analyzing links from page https://pypi.python.org/simple/django/Found link 
https://pypi.python.org/packages/any/D/Django/Django-1.5.2-py2.py3-none-any.whl#md5=07f0d2d42162945d0ad031fc9737847d
 (from https://pypi.python.org/simple/django/), version: 1.5.2Found link 
https://pypi.python.org/packages/any/D/Django/Django-1.5.8-py2.py3-none-any.whl#md5=1e3418bd1d6f9725a3d1264c9352f2a1
 (from https://pypi.python.org/simple/django/), version: 1.5.8Found link 
https://pypi.python.org/packages/any/D/Django/Django-1.6.1-py2.py3-none-any.whl#md5=c7b7a4437b36400f1c23953e9700fd29
 (from https://pypi.python.org/simple/django/), version: 1.6.1Found link 
https://pypi.python.org/packages/any/D/Django/Django-1.6.2-py2.py3-none-any.whl#md5=3bd014923e85df771b34d12c0ab3c9e1
 (from https://pypi.python.org/simple/django/), version: 1.6.2Found link 
https://pypi.python.org/packages/any/D/Django/Django-1.6.5-py2.py3-none-any.whl#md5=2bcdb4729f9f358b0925b532eef0a8ff
 (from https://pypi.python.org/simple/django/), version: 
1.6.5..Found link 
https://pypi.python.org/packages/source/D/Django/Django-1.8.8.tar.gz#md5=08ecf83b7e9d064ed7e3981ddc3a8a15
 (from https://pypi.python.org/simple/django/), version: 1.8.8Found link 
https://pypi.python.org/packages/source/D/Django/Django-1.8.9.tar.gz#md5=49f6863b1c83825fb2f473c141c28e15
 (from https://pypi.python.org/simple/django/), version: 1.8.9Found link 
https://pypi.python.org/packages/source/D/Django/Django-1.8.tar.gz#md5=9a811faf67ca0f3e0d43e670a1cc503d
 (from https://pypi.python.org/simple/django/), version: 1.8Found link 
https://pypi.python.org/packages/source/D/Django/Django-1.9.1.tar.gz#md5=02754aa2d5c9c171dfc3f9422b20e12c
 (from https://pypi.python.org/simple/django/), version: 1.9.1Found link 
https://pypi.python.org/packages/source/D/Django/Django-1.9.2.tar.gz#md5=ee90280973d435a1a6aa01b453b50cd1
 (from https://pypi.python.org/simple/django/), version: 1.9.2Found link 
https://pypi.python.org/packages/source/D/Django/Django-1.9.tar.gz#md5=110389cf89196334182295165852e082
 (from https://pypi.python.org/simple/django/), version: 1.9Found link 
https://pypi.python.org/packages/source/D/Django/Django-1.9rc1.tar.gz#md5=b971686521ea09b4bf82aec3e794fcbc
 (from https://pypi.python.org/simple/django/), version: 1.9rc1Using version 
1.8.8 (newest of versions: 1.8.8, 1.8.8)"GET 
/packages/py2.py3/D/Django/Django-1.8.8-py2.py3-none-any.whl HTTP/1.1" 200 
6170205Downloading Django-1.8.8-py2.py3-none-any.whl (6.2MB)Downloading from 
URL 
https://pypi.python.org/packages/py2.py3/D/Django/Django-1.8.8-py2.py3-none-any.whl#md5=97334c82efbac0f93f8b6dd4ee4b516f
 (from 

Re: var1 = var2 = var3

2016-02-17 Thread srinivas devaki
what a coincidence, i just asked a similar question 7 hours before
you, at python-l...@python.org

here's the link, you can extend the discussion there to get more
answers, as it is more related to the language rather than django.

link: https://mail.python.org/pipermail/python-list/2016-February/703235.html


On Wed, Feb 17, 2016 at 1:35 AM, anotherdjangonewby
 wrote:
> Hi,
>
> this may be a bit off-topic, but:
>
> How are expressions like:
>
> var1 = var2 = var3
>
> called Python. Without a hint I cannot goolge this.
>
> Thanks
>
> Kai
>
> --
> 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/56C38119.5040807%40gmx.de.
> For more options, visit https://groups.google.com/d/optout.



-- 
Regards
Srinivas Devaki
Junior (3rd yr) student at Indian School of Mines,(IIT Dhanbad)
Computer Science and Engineering Department
ph: +91 9491 383 249
telegram_id: @eightnoteight

-- 
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/CACs7g%3DCoEX%3DPd%2BAdThzZ%2BcTHzMGVDksPo%2BKK-GRjWhq8knQpvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: file upload fails with slow network bandwith in django

2016-02-17 Thread Pablo Conesa


El martes, 16 de febrero de 2016, 21:12:32 (UTC+1), James Schneider 
escribió:
>
> How long does the file upload work before receiving the error? 
>

 There is no response from the server (fiddler returns -1, whatever this 
 means) 

>>>
>>> Well, no response from the server doesn't necessarily mean that there 
>>> were no logs. Can you check the error and access logs of the server? 
>>>
>>
>>
>
> Have you checked the server logs?
>

Yesthere are no logs!! I knowjust joined the project and we are 
using the email handlersad! 

>
>  
>
>>  
>>
>>>
>>> Does Fiddler return an immediate response of -1, or does it seem like 
>>> there is a timeout period?
>>>
>>
>> immediate response, no time out period.
>>
>
>
> Without looking at the server logs, I can only guess that Gnuicorn is 
> unhappy with the headers that are being sent, and might be closing the 
> connection. A long timeout would probably indicate that Gnuicorn is waiting 
> for more data but something in the upload process is not triggering that it 
> has reached the end of the data stream.
>

I've done some more test and seems that the -1 is normal while data it's 
been uploaded. Nothing wrong with that. So I guess we need to config the 
logging and start looking at it. 

>
>  
>
>>
>>> After a quick glance at Fiddler itself, are you using any customizations 
>>> on the rules 
>>>
>>
>> no customization. Default "Simulate Modem speeds". I must say I use 
>> fiddle to be able to reproduce the error locally. If I hit the server 
>> (production) using wifi (slower than ethernet) I got the same thing, no 
>> fiddler in the middle.
>>
>
> But it works using a wired Ethernet connection? Honestly, the speed 
> difference between Wi-Fi and Ethernet for this purpose is probably not 
> relevant to the problem. The server logs would tell you more about what is 
> happening.
>  
>

logs, logs, logsI'm on it. :-( 

>
>
>>>
> Nice advice...I'll look into this. Do you know any nice example for 
 that JS library chunk upload.

>
>
>>>
>>> Probably best to stick with your existing JS framework of choice if you 
>>> are using one. All of the major ones have some version of a chunked 
>>> uploader (JQuery and Angular), and I come across resumable.js fairly 
>>> frequently. I've never personally had a need for one, so I can't really 
>>> comment on them in any sort of detail or make a recommendation. 
>>>
>>
>> Testing resumable.jslet's see how it goes. 
>>
>> So, far there is some response, but after a while got 404 response 
>> (testing locally against DAJNGO)will it make a difference against 
>> gunicorn?
>>
>>
>> 
>>
>
> This smells like either a memory exhaustion/ceiling issue or some kind of 
> internal connection/process timeout, neither of which are likely easy to 
> adjust using the Django dev server. Gunicorn probably has 10,000 knobs to 
> adjust those timers and limits, though. 
>
> Look at the server error/access logs.
>

againlogs, logs, logsI'll setup gunicorn locally and enable logging.

For someone wanting to move to a file chunk upload, I've tried resumable.js 
and a django component for it. it was failing. Now I'm happier with this 
other: https://github.com/juliomalegria/django-chunked-upload-demo (test 
over wifi ave worked fine). But again.maybe the problem is in our setup 
and not in those tools.

Thanks, James, you've been vary helpful.

>
> -James
>

-- 
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/ba2e9f2d-2c6d-4a4a-9259-14a8e95d9135%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: null datetime field and json fixtures

2016-02-17 Thread James Schneider
On Tue, Feb 16, 2016 at 4:35 PM, Malik Rumi  wrote:

> There are a ton of answers to this question out there - if you can wade
> through all the ones that refer to forms and not models. The consensus
> seems to be that datetime has to be set to both blank=true and null=true.
> And when I put in one test row of data manually through the admin, I could
> leave my datetime field blank with no problems. But when I tried to load
> the 89 other instances through a fixture, I got error after error.
>

A blank form field is different than a missing field in a JSON dump, as
each is handled differently within the Django workflow. A programmatic way
to look at this would be: (blank=True) != (null=True).

blank=True controls whether or not a form will accept an empty value in the
form field as part of the validation mechanism for that field. It has no
bearing on model objects created through other means, such as part of a
fixture, or some view code that runs foo.save() somewhere.

Conversely, null=True only applies to models and saving to the database,
and even then, is not part of the validation mechanism when foo.save() is
called. It really just serves as a flag to the model inspection mechanism
for generating the schema that the database uses. Enforcement of missing
fields or fields with a Null/None value is done at the database level, not
at the model level within Python/Django. Obviously there are ways to inject
validation at the model level to prevent such issues, but very few, if any,
are used by default.

In form fields that accept arbitrary text input, a blank field is submitted
as an empty string. DateTime form fields are actually the same under the
hood, but most use some fancy JS to pretty it up with date-time pop up
selectors. If left blank in the form, an empty string is sent through the
form submission. Django then coerces the data (empty string) for the
DateTime form field to None for use later by the view/model, which is not
the case for other CharField-type fields that are left as an empty string.
Compare the empty values:

https://docs.djangoproject.com/en/1.9/ref/forms/fields/#charfield
https://docs.djangoproject.com/en/1.9/ref/forms/fields/#datetimefield

When a blank (empty) value is provided through a form for a DateTime *form*
field, the DateTime *model* field will be populated with None, and the
resulting foo.save() operation will save the DateTime *model* field as NULL
in the database.

That's why for *model* CharField definitions (and other similar model
fields), it is a common pattern to only see blank=True, and NOT null=True,
because model CharFields are either saved with the text that was submitted,
or an empty string, but never as NULL (even with null=True).


>
> As near as I can tell, if you leave a json value blank, loaddata says it
> isn't a json document. But if you put the empty string, '', Null, None,
> "Null", "None" or "-00-00" in there, it is rejected as not valid date
> format. Therefore, it seems there is no way to do this through a fixture.
> My question: Is this correct? If so, is there any alternative to doing it
> all manually? Thanks.
>

When you are talking fixtures, everything I just mentioned about forms is
thrown out (unless of course you are manually submitting the data in your
fixtures programmatically through Django forms, which is not entirely
uncommon since you can take advantage of form validation to eliminate/clean
bad data rows during an import). I only mentioned forms to help understand
why a 'blank' value in the Admin seems to work fine but your fixture is
failing.

The likely reason your fixture is failing is because you are expecting the
coercion of a missing/blank field to be handled like it is when data is
submitted through the form process. Django is expecting fixture data to be
pre-processed already from a known-good data source, and I believe that the
data is inserted using very low-level database API calls, and is not using
the standard ORM magic that we all know and love.

When you say you "leave a json value blank", what do you mean? Are you
removing the field entirely from the object definition? It appears that you
are keeping the field defined, but you want the equivalent of Python's
None. Python equates None to null (bare keyword in JSON), so your field
should probably be something like "updated_on: null," (without quotes). See
the table here: https://docs.python.org/3/library/json.html#py-to-json-table

Anyway, it sounds like the data source you are using is not correctly
serializing what is to become your problematic DateTime model fields. You
have these choices:


   1. Fix the data source and have it generate/serialize to a proper
   representation of your data, using either a real date or null to represent
   an 'empty' or 'no date specified' value. An empty string does not make
   sense as a value for a DateTime field (hence the coercion gymnastics that
   form fields perform). Preferred.
   2. Write a custom 

Re: null datetime field and json fixtures

2016-02-17 Thread Avraham Serour
Try not setting any value to the field, it should be saved with the default
value

On Wed, Feb 17, 2016, 2:35 AM Malik Rumi  wrote:

> There are a ton of answers to this question out there - if you can wade
> through all the ones that refer to forms and not models. The consensus
> seems to be that datetime has to be set to both blank=true and null=true.
> And when I put in one test row of data manually through the admin, I could
> leave my datetime field blank with no problems. But when I tried to load
> the 89 other instances through a fixture, I got error after error.
>
> As near as I can tell, if you leave a json value blank, loaddata says it
> isn't a json document. But if you put the empty string, '', Null, None,
> "Null", "None" or "-00-00" in there, it is rejected as not valid date
> format. Therefore, it seems there is no way to do this through a fixture.
> My question: Is this correct? If so, is there any alternative to doing it
> all manually? Thanks.
>
> --
> 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/db367bcf-8cbf-4001-8976-f602e93576d5%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAFWa6t%2B4KAx40tR_D0ENcUwL7UHs_QrADQL-eqNYyRnz48z_FA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.