Re: Django throws ImproperlyConfigured error when loading URLconf on startup

2014-01-02 Thread Ahmed Khan
Any progress on this? Does anyone know the causes?

On Sunday, June 23, 2013 2:55:16 PM UTC+5, Pratik Mandrekar wrote:
>
> Has anyone been able to resolve this?
>
> I am facing the same issue.
>
> On Sunday, March 24, 2013 8:46:26 PM UTC+5:30, Dan Gentry wrote:
>>
>> Andrei, I once received this error when the problem was actually in 
>> another python module being imported - in my case views.py.  Hope this 
>> helps, Dan
>
>

-- 
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/6df3be6b-e0a6-41d0-b41a-40bae2e52d8c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django GenericRelation not working

2014-01-02 Thread arthur . muchir
I have the following model in my app, using the content-type django 
framework in version 1.6.1 :

class GenericMedia(models.Model):
limit   = models.Q(model = 'Image') | models.Q(model = 'Video') | 
models.Q(model = 'Other')
content_type= models.ForeignKey(ContentType, limit_choices_to = limit)
object_id   = models.PositiveIntegerField()
content_object  = generic.GenericForeignKey('content_type', 'object_id')

def __unicode__(self):
return u"%s" % os.path.basename(self.content_object.url.name)

def instance(self):
return self.content_object.__class__.__name__

class Media(models.Model):
description = models.CharField(blank = True, max_length = 500)
link= models.URLField(blank = True)
genericFK   = generic.GenericRelation(GenericMedia, 
content_type_field='content_type', object_id_field='object_id')

class Meta:
abstract = True

def __unicode__(self):
return u"%s" % os.path.basename(self.url.name)

def save(self, *args, **kwargs):
super(Media, self).save(*args, **kwargs)
generic_link = GenericMedia(content_object = self)
generic_link.save()

class Image(Media):
imgW = models.PositiveSmallIntegerField()
imgH = models.PositiveSmallIntegerField()
url  = models.ImageField(upload_to = 'mediamanager', height_field = 'imgH', 
width_field = 'imgW')

Everythings works fine, excepts the GenericRelation in my abstract Media Class.

In django documentation it is said that :
If you delete an object that has a GenericRelation, any objects which have a 
GenericForeignKey pointing at it will be deleted as well.

But my problem is that when I delete an image (wich extends Media), the 
GenericMedia pointing to it is not deleted.

If anyone has a solution, 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9a090654-0298-4cfd-a71b-c815cca53ee0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


How to approach this problem?

2014-01-02 Thread César García Tapia
I'm trying to solve a problem, but I have no idea how to face it. I need 
some help :-)

I have a model hierarchy like this:

class Task(models.Model):
name = models.CharField(max_length=255)
number_of_steps = models.IntegerField()

class StepGroup(models.Model):
task = models.ForeignKey(Task)
init_date = models.DateField()

class Step(models.Model):
group = models.ForeignKey(StepGroup)
name = models.CharField(max_length=255)

I must write a dialog where I create a number of Step Groups. An 
InlineFormSet looks the way to go, but as there are two levels of nesting, 
I don't know how to do that.

Besides, I need the usual stuff with forms: error control 
(form.name_of_field.errors), autopopulation when editing the Task, etc, so 
doing it manually with javascript and server-side handling of the POST 
request would be too complicated and error-prone.

This is the way I need the form (the number of steps in each group is set 
by the "number_of_steps" field in the Task model):

+---+
| STEP GROUP 1  |
|   |
| Init date: _  |
|   |
| Step 1:   |
| Step 2:   |
| Step 3:   |
|   |
+---+
| STEP GROUP 2  |
|   |
| Init date: _  |
|   |
| Step 1:   |
| Step 2:   |
| Step 3:   |
|   |
+---+
|   |
| +---+ |
| | Create step group | |
| +---+ |
+---+

Please, any kind of help, suggestion or link will be very appreciated :-)

-- 
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/0f74890d-0271-4614-98c3-311cfbdcd635%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


django 1.6 When creating superuser in cmd.exe, why ask a password for three times?

2014-01-02 Thread 项楠


django 1.6.1,python 3.3.3, windows 8.

I choose Substituting a custom User 
model,
 
and everything is ok except creating superuser at the beginning:

[image: enter image description here]

As you can see, django asked password for three times despite the success 
in creating the superuser., why?

this is the source code , if needed. 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/695f6660-08c6-454e-bf62-549759dd6b54%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django 1.6 When creating superuser in cmd.exe, why ask a password for three times?

2014-01-02 Thread Russell Keith-Magee
Hi,

I can't check your source code (I haven't got a baidu account, which
appears to be a requirement for downloading the zip file you've provided),
but you should only be asked for your password twice.

My guess is that you've included "password" in your list of
REQUIRED_FIELDS. REQUIRED_FIELDS only needs to include user-added fields on
your own model - for example, if ever user must have a date of birth, you
can put the date_of_birth field in REQUIRED_FIELDS. You *don't* need to
include username, password, or any of the built-in fields that Django
provides as part of the base user model. Remove 'password' from
REQUIRED_FIELDS, and you should only get two requests for a password.

I can see why you've made this error - the documentation isn't clear on
this point. I've opened ticket #21726 [1] to make sure this is addressed.

[1] https://code.djangoproject.com/ticket/21726

Yours,
Russ Magee %-)



On Fri, Jan 3, 2014 at 9:11 AM, 项楠  wrote:

> django 1.6.1,python 3.3.3, windows 8.
>
> I choose Substituting a custom User 
> model,
> and everything is ok except creating superuser at the beginning:
>
> [image: enter image description here]
>
> As you can see, django asked password for three times despite the success
> in creating the superuser., why?
>
> this is the source code , if needed.
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/695f6660-08c6-454e-bf62-549759dd6b54%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAJxq84_-E186PVvZ9YdmAn-fP-QL4T8wVXDPMkn_M3xYfrY49w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django 1.6 When creating superuser in cmd.exe, why ask a password for three times?

2014-01-02 Thread 项楠
It worked. Thank you. BTW, could you recommend a site for sharing files not 
requiring an account?

在 2014年1月3日星期五UTC+8上午9时28分57秒,Russell Keith-Magee写道:
>
> Hi,
>
> I can't check your source code (I haven't got a baidu account, which 
> appears to be a requirement for downloading the zip file you've provided), 
> but you should only be asked for your password twice.
>
> My guess is that you've included "password" in your list of 
> REQUIRED_FIELDS. REQUIRED_FIELDS only needs to include user-added fields on 
> your own model - for example, if ever user must have a date of birth, you 
> can put the date_of_birth field in REQUIRED_FIELDS. You *don't* need to 
> include username, password, or any of the built-in fields that Django 
> provides as part of the base user model. Remove 'password' from 
> REQUIRED_FIELDS, and you should only get two requests for a password.
>
> I can see why you've made this error - the documentation isn't clear on 
> this point. I've opened ticket #21726 [1] to make sure this is addressed.
>
> [1] https://code.djangoproject.com/ticket/21726
>
> Yours,
> Russ Magee %-)
>
>
>
> On Fri, Jan 3, 2014 at 9:11 AM, 项楠 >wrote:
>
>> django 1.6.1,python 3.3.3, windows 8.
>>
>> I choose Substituting a custom User 
>> model,
>>  
>> and everything is ok except creating superuser at the beginning:
>>
>> [image: enter image description here]
>>
>> As you can see, django asked password for three times despite the success 
>> in creating the superuser., why?
>>
>> this is the source code , if needed. 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/695f6660-08c6-454e-bf62-549759dd6b54%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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/3b8c6fd9-df94-4b16-b2df-38926a19873e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django 1.6 When creating superuser in cmd.exe, why ask a password for three times?

2014-01-02 Thread Russell Keith-Magee
Glad to hear you could solve your problem.

As for sharing files without needing an account; two options I can think of:

 1) Github Gists (https://gist.github.com) are useful for sharing a small
number of files, especially source code. You can also update the files,
keep track of versions, receive comments and so on.

 2) Dropbox allows you to put files into a public folder and share a URL to
that file.

Both these services will require *you* to create an account, but the person
reading/receiving your files will not.

Hope that helps!

Yours,
Russ Magee %-)

On Fri, Jan 3, 2014 at 10:26 AM, 项楠  wrote:

> It worked. Thank you. BTW, could you recommend a site for sharing files
> not requiring an account?
>
> 在 2014年1月3日星期五UTC+8上午9时28分57秒,Russell Keith-Magee写道:
>>
>> Hi,
>>
>> I can't check your source code (I haven't got a baidu account, which
>> appears to be a requirement for downloading the zip file you've provided),
>> but you should only be asked for your password twice.
>>
>> My guess is that you've included "password" in your list of
>> REQUIRED_FIELDS. REQUIRED_FIELDS only needs to include user-added fields on
>> your own model - for example, if ever user must have a date of birth, you
>> can put the date_of_birth field in REQUIRED_FIELDS. You *don't* need to
>> include username, password, or any of the built-in fields that Django
>> provides as part of the base user model. Remove 'password' from
>> REQUIRED_FIELDS, and you should only get two requests for a password.
>>
>> I can see why you've made this error - the documentation isn't clear on
>> this point. I've opened ticket #21726 [1] to make sure this is addressed.
>>
>> [1] https://code.djangoproject.com/ticket/21726
>>
>> Yours,
>> Russ Magee %-)
>>
>>
>>
>> On Fri, Jan 3, 2014 at 9:11 AM, 项楠  wrote:
>>
>>> django 1.6.1,python 3.3.3, windows 8.
>>>
>>> I choose Substituting a custom User 
>>> model,
>>> and everything is ok except creating superuser at the beginning:
>>>
>>> [image: enter image description here]
>>>
>>> As you can see, django asked password for three times despite the
>>> success in creating the superuser., why?
>>>
>>> this is the source code , if needed.
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@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/695f6660-08c6-454e-bf62-549759dd6b54%
>>> 40googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
> 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/3b8c6fd9-df94-4b16-b2df-38926a19873e%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAJxq84_AKFAYeLgXhTXO%2By1DeDKtyp4YdARSChvqM-Eh30OK%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django 1.6 When creating superuser in cmd.exe, why ask a password for three times?

2014-01-02 Thread 项楠
Thank you :-) again.

在 2014年1月3日星期五UTC+8上午10时30分01秒,Russell Keith-Magee写道:
>
> Glad to hear you could solve your problem.
>
> As for sharing files without needing an account; two options I can think 
> of:
>
>  1) Github Gists (https://gist.github.com) are useful for sharing a small 
> number of files, especially source code. You can also update the files, 
> keep track of versions, receive comments and so on.
>
>  2) Dropbox allows you to put files into a public folder and share a URL 
> to that file. 
>
> Both these services will require *you* to create an account, but the 
> person reading/receiving your files will not.
>
> Hope that helps!
>
> Yours,
> Russ Magee %-)
>
> On Fri, Jan 3, 2014 at 10:26 AM, 项楠 >wrote:
>
>> It worked. Thank you. BTW, could you recommend a site for sharing files 
>> not requiring an account?
>>
>> 在 2014年1月3日星期五UTC+8上午9时28分57秒,Russell Keith-Magee写道:
>>>
>>> Hi,
>>>
>>> I can't check your source code (I haven't got a baidu account, which 
>>> appears to be a requirement for downloading the zip file you've provided), 
>>> but you should only be asked for your password twice.
>>>
>>> My guess is that you've included "password" in your list of 
>>> REQUIRED_FIELDS. REQUIRED_FIELDS only needs to include user-added fields on 
>>> your own model - for example, if ever user must have a date of birth, you 
>>> can put the date_of_birth field in REQUIRED_FIELDS. You *don't* need to 
>>> include username, password, or any of the built-in fields that Django 
>>> provides as part of the base user model. Remove 'password' from 
>>> REQUIRED_FIELDS, and you should only get two requests for a password.
>>>
>>> I can see why you've made this error - the documentation isn't clear on 
>>> this point. I've opened ticket #21726 [1] to make sure this is addressed.
>>>
>>> [1] https://code.djangoproject.com/ticket/21726
>>>
>>> Yours,
>>> Russ Magee %-)
>>>
>>>
>>>
>>> On Fri, Jan 3, 2014 at 9:11 AM, 项楠  wrote:
>>>
 django 1.6.1,python 3.3.3, windows 8.

 I choose Substituting a custom User 
 model,
  
 and everything is ok except creating superuser at the beginning:

 [image: enter image description here]

 As you can see, django asked password for three times despite the 
 success in creating the superuser., why?

 this is the source code , if needed. 
 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...@googlegroups.com.
 To post to this group, send email to django...@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/695f6660-08c6-454e-bf62-549759dd6b54%
 40googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

>>>
>>>  -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/3b8c6fd9-df94-4b16-b2df-38926a19873e%40googlegroups.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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/55b4a871-1399-4a0f-bb28-4fb745ef130d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Runserver Error (Exceptions) in Latest Django Dev Version with Python 3.3

2014-01-02 Thread Noah Fang
Django newbie here. I just checked out and installed the latest dev version 
as instructed and created a project, but when trying to "python manage.py 
runserver", it gives the following error message.

Anyone has any clue? Huge thanks!

$ python manage.py runserver
Traceback (most recent call last):
  File "/Users/noahark/Dev/django-trunk/django/apps/base.py", line 66, in 
create
module = import_module(entry)
  File 
"/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/__init__.py",
 
line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1584, in _gcd_import
  File "", line 1565, in _find_and_load
  File "", line 1532, in 
_find_and_load_unlocked
  File "", line 584, in _check_name_wrapper
  File "", line 1022, in load_module
  File "", line 1003, in load_module
  File "", line 560, in 
module_for_loader_wrapper
  File "", line 868, in _load_module
  File "", line 313, in 
_call_with_frames_removed
  File "/Users/noahark/Dev/django-trunk/django/contrib/admin/__init__.py", 
line 5, in 
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, 
VERTICAL
  File "/Users/noahark/Dev/django-trunk/django/contrib/admin/options.py", 
line 31, in 
from django.shortcuts import get_object_or_404
ImportError: bad magic number in 'django.shortcuts': b'\x03\xf3\r\n'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/noahark/Dev/django-trunk/django/apps/base.py", line 80, in 
create
cls = getattr(mod, cls_name)
AttributeError: 'module' object has no attribute 'admin'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"/Users/noahark/Dev/django-trunk/django/core/management/__init__.py", line 
426, in execute_from_command_line
utility.execute()
  File 
"/Users/noahark/Dev/django-trunk/django/core/management/__init__.py", line 
389, in execute
django.setup()
  File "/Users/noahark/Dev/django-trunk/django/__init__.py", line 21, in 
setup
apps.populate(settings.INSTALLED_APPS)
  File "/Users/noahark/Dev/django-trunk/django/apps/registry.py", line 81, 
in populate
app_config = AppConfig.create(entry)
  File "/Users/noahark/Dev/django-trunk/django/apps/base.py", line 86, in 
create
"cannot import name '%s' from '%s'" % (cls_name, mod_path))
ImportError: cannot import name 'admin' from 'django.contrib'

-- 
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/7392c868-0f67-4523-a99e-8854cccfd73e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


NameError "SignUpAdmin"

2014-01-02 Thread Eddie29
Hi Guys, 
I am really new to Django and Python. I have recently started learning them 
from a course on Udemy and I got stuck on the first example, making a web 
app. I'm not sure what I have done wrong but when I run my Django server it 
comes up with a NameError. I think the app is supposed to handle user data, 
such as first name,last name and email. 
Thanks in advance :)


-- 
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/468b9c2b-5ff6-412a-bc4f-e3c26aa3ddaf%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
from django.db import models
from django.utils.encoding import smart_unicode
# Create your models here.

class SignUp(models.Model):
first_name = models.CharField(max_length=120, null=True, blank=True)
last_name = models.CharField(max_length=120, null=True, blank=True)
email = models.EmailField()
timestamp = models.DateTimeField(auto_now_add =True, auto_now=False)
updated = models.DateTimeField(auto_now_add=False, auto_now=True)

def __unicode__(self):
return smart_unicode(self.email)
pass
from django.contrib import admin
#Everything Below this

from .models import SignUp


class SignUpAdmin(admin.ModelAdmin):
class Meta:
model = SignUp

admin.site.register(SignUp, SignUpAdmin)
#code


Re: NameError "SignUpAdmin"

2014-01-02 Thread Thomas Lockhart

On 1/2/14 7:02 PM, Eddie29 wrote:

Hi Guys,
I am really new to Django and Python. I have recently started learning 
them from a course on Udemy and I got stuck on the first example, 
making a web app. I'm not sure what I have done wrong but when I run 
my Django server it comes up with a NameError. I think the app is 
supposed to handle user data, such as first name,last name and email.
I'm not familiar with the course, and haven't tried to set up your 
project to test.


But I can recommend that you start with the Django tutorial in the 
Django docs (whichever doc version matches the version of Django you are 
using). You might then find it easier to spot small problems in other 
projects such as when you go back to your course.


hth

   - Tom


Thanks in advance :)


--
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/468b9c2b-5ff6-412a-bc4f-e3c26aa3ddaf%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
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/52C63201.6040207%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Runserver Error (Exceptions) in Latest Django Dev Version with Python 3.3

2014-01-02 Thread Russell Keith-Magee
On Fri, Jan 3, 2014 at 9:32 AM, Noah Fang  wrote:

> Django newbie here. I just checked out and installed the latest dev
> version as instructed and created a project, but when trying to "python
> manage.py runserver", it gives the following error message.
>
> Anyone has any clue? Huge thanks!
>
> $ python manage.py runserver
> Traceback (most recent call last):
>   File "/Users/noahark/Dev/django-trunk/django/apps/base.py", line 66, in
> create
> module = import_module(entry)
>   File
> "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/__init__.py",
> line 90, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1584, in _gcd_import
>   File "", line 1565, in _find_and_load
>   File "", line 1532, in
> _find_and_load_unlocked
>   File "", line 584, in _check_name_wrapper
>   File "", line 1022, in load_module
>   File "", line 1003, in load_module
>   File "", line 560, in
> module_for_loader_wrapper
>   File "", line 868, in _load_module
>   File "", line 313, in
> _call_with_frames_removed
>   File "/Users/noahark/Dev/django-trunk/django/contrib/admin/__init__.py",
> line 5, in 
> from django.contrib.admin.options import ModelAdmin, HORIZONTAL,
> VERTICAL
>   File "/Users/noahark/Dev/django-trunk/django/contrib/admin/options.py",
> line 31, in 
> from django.shortcuts import get_object_or_404
> ImportError: bad magic number in 'django.shortcuts': b'\x03\xf3\r\n'
>

This error is a bit of a red flag -- it means that you've got mixed Python
byte code versions. Somehow, you've generated byte code using one version
of Python, and you're then running the code using a different version of
Python.

Unfortunately, I have *no* idea how you might have caused this problem. It
looks like you're running on a Mac, so it's possible that the system is
getting confused over whether system python is Python 3 or Python 2 --
you're invoking "python manage.py runserver" at the command line and
getting Python 3, but if some quirk of your environment is causing Python 2
to be the system default somewhere, you will get problems.

My suggestion here is to make sure you're running your code in a virtualenv
[1] -- that will make sure that the "local" Python is always clear. Using
virtualenv is good practice anyway for Python development, because it
isolates the dependencies of each project from each other.

[1] http://www.virtualenv.org/en/latest/

Yours,
Russ Magee %-)

-- 
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/CAJxq84-1wnKfA8fkzMOTWBHv51_ykPj6QWneKLvRs4Q6kurnuw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.