legacy oracle database -w- existing schema

2009-03-16 Thread bruce

Hi-
I'm a new user to Django.  I've searched through the documentation and
other posted questions.  I'm currently attempting to setup the model
to access an Oracle 9 database.  I have access the database, yet the
tables and views are stored in another existing schema not owned by
me.

Other than creating custom sql queries, is there another way to
retrieve information found in this schema?

Bruce

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: legacy oracle database -w- existing schema

2009-03-16 Thread bruce

I can look into that as an option.  I don't have access to
administrate this database.

On Mar 16, 2:29 pm, "Mad Sweeney"  wrote:
> - Original Message -----
> From: "bruce" 
> To: "Django users" 
> Sent: Monday, March 16, 2009 9:00 PM
> Subject: legacy oracle database -w- existing schema
>
> > Hi-
> > I'm a new user to Django.  I've searched through the documentation and
> > other posted questions.  I'm currently attempting to setup the model
> > to access an Oracle 9 database.  I have access the database, yet the
> > tables and views are stored in another existing schema not owned by
> > me.
>
> > Other than creating custom sql queries, is there another way to
> > retrieve information found in this schema?
>
> Hi,
>
> How about creating synonyms in your own schema,
> one for each table in your model?
>
> --j
>
>
>
>
>
> > Bruce
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: legacy oracle database -w- existing schema

2009-03-16 Thread bruce

Yes, this resolve the issue.

Thank you!

On Mar 16, 2:29 pm, "Mad Sweeney"  wrote:
> - Original Message -----
> From: "bruce" 
> To: "Django users" 
> Sent: Monday, March 16, 2009 9:00 PM
> Subject: legacy oracle database -w- existing schema
>
> > Hi-
> > I'm a new user to Django.  I've searched through the documentation and
> > other posted questions.  I'm currently attempting to setup the model
> > to access an Oracle 9 database.  I have access the database, yet the
> > tables and views are stored in another existing schema not owned by
> > me.
>
> > Other than creating custom sql queries, is there another way to
> > retrieve information found in this schema?
>
> Hi,
>
> How about creating synonyms in your own schema,
> one for each table in your model?
>
> --j
>
>
>
>
>
> > Bruce
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django 1.4 + grappelli 2.4: missing css, img files.

2012-06-27 Thread bruce
Dear All,

I know this problem is related with grappelli. But it may be a django 
configure problem. So I am posting my question here.
If it is inappropriate, please let me know. 

I followed the django 1.4's tutorial to setup the 'polls' app and it was 
successful.
I also followed the grappelli 2.4 quick start guide. 
http://django-grappelli.readthedocs.org/en/grappelli_2_4/quickstart.html

I followed every step and didn't do anything else. 
The last command is:
python manage.py collectstatic
After this command is executed, two new directories were created(admin and 
grappelli).

The directory is as follows:
 root@ubuntu:/home/hduser/django/mysite# pwd
/home/hduser/django/mysite
root@ubuntu:/home/hduser/django/mysite# ls
admin  grappelli  manage.py  mysite  mytemplate  polls

Finally, 
I can access the http://127.0.0.1:8000/admin
But, the css,img files are missing. Please see the attached screen shot 
picture. 

The python manage.py runserver show:
[27/Jun/2012 21:36:19] "GET /admin/css/base.css HTTP/1.1" 404 4468
[27/Jun/2012 21:36:19] "GET 
/admin/jquery/ui/css/custom-theme/jquery-ui-1.8.custom.css HTTP/1.1" 404 
4585
[27/Jun/2012 21:36:19] "GET /admin/css/jquery-ui-grappelli-extensions.css 
HTTP/1.1" 404 4546
[27/Jun/2012 21:36:19] "GET /admin/jquery/jquery-1.6.2.min.js HTTP/1.1" 404 
4510
[27/Jun/2012 21:36:19] "GET 
/admin/jquery/ui/js/jquery-ui-1.8.15.custom.min.js HTTP/1.1" 404 4561
[27/Jun/2012 21:36:19] "GET /admin/js/grappelli/grappelli.js HTTP/1.1" 404 
4507
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_collapsible.js 
HTTP/1.1" 404 4546
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_timepicker.js 
HTTP/1.1" 404 4543
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_collapsible_group.js HTTP/1.1" 404 4564
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_fk.js 
HTTP/1.1" 404 4543
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_m2m.js 
HTTP/1.1" 404 4546
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_related_generic.js HTTP/1.1" 404 4558
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_autocomplete_fk.js HTTP/1.1" 404 4558
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_autocomplete_m2m.js HTTP/1.1" 404 4561
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_autocomplete_generic.js HTTP/1.1" 404 4573
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_timepicker.js 
HTTP/1.1" 404 4543
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_fk.js 
HTTP/1.1" 404 4543
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_m2m.js 
HTTP/1.1" 404 4546
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_related_generic.js HTTP/1.1" 404 4558
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_autocomplete_fk.js HTTP/1.1" 404 4558
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_autocomplete_m2m.js HTTP/1.1" 404 4561
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_autocomplete_generic.js HTTP/1.1" 404 4573



Would you please tell me how to fix it? 
Why 404? 
I know I am supposed to read some web links. Please tell me. 
Thank you!!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/egmDj5ZbW40J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

<>

Re: django 1.4 + grappelli 2.4: missing css, img files.

2012-06-28 Thread bruce
Thanks Karl for your reply. 
It would appear that ADMIN_MEDIA_PREFIX is Deprecated in django 1.4

root@lablinux:~/django/mysite# python manage.py  runserver 0.0.0.0:8000
/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py:75: 
DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use 
STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py:75: 
DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use 
STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
Validating models...


I realized that I didn't post my setting.py
Please see my bellowing setting.py:

MEDIA_ROOT = ''
MEDIA_URL = ''
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'grappelli',
'django.contrib.admin',
'polls',
)


The directory tree is as follows:
root@lablinux:/home/hduser/django/mysite# pwd
/home/hduser/django/mysite
root@lablinux:/home/hduser/django/mysite# ls
admin  grappelli  manage.py  mysite  polls

any idea? 
Thanks a lot!!!



On Thursday, June 28, 2012 3:04:25 AM UTC-4, Karl Sutt wrote:
>
> Ali,
>
> Given that your static directory is STATIC_URL = '/static/' and 
> STATIC_ROOT is something like os.path.join(PROJECT_PATH, "static"), add
>
>> ADMIN_MEDIA_PREFIX = '/static/grappelli/' (or whatever your static 
>> directory is) to your settings.py
>
>
> That should do the trick. 
>
> Tervitades/Regards
> Karl Sutt
>
>
> On Thu, Jun 28, 2012 at 5:07 AM, bruce  wrote:
>
>> Dear All,
>>
>> I know this problem is related with grappelli. But it may be a django 
>> configure problem. So I am posting my question here.
>> If it is inappropriate, please let me know. 
>>
>> I followed the django 1.4's tutorial to setup the 'polls' app and it was 
>> successful.
>> I also followed the grappelli 2.4 quick start guide. 
>> http://django-grappelli.**readthedocs.org/en/grappelli_**
>> 2_4/quickstart.html<http://django-grappelli.readthedocs.org/en/grappelli_2_4/quickstart.html>
>>
>> I followed every step and didn't do anything else. 
>> The last command is:
>> python manage.py collectstatic
>> After this command is executed, two new directories were created(admin 
>> and grappelli).
>>
>> The directory is as follows:
>>  root@ubuntu:/home/hduser/**django/mysite# pwd
>> /home/hduser/django/mysite
>> root@ubuntu:/home/hduser/**django/mysite# ls
>> admin  grappelli  manage.py  mysite  mytemplate  polls
>>
>> Finally, 
>> I can access the http://127.0.0.1:8000/**admin<http://127.0.0.1:8000/admin>
>> But, the css,img files are missing. Please see the attached screen shot 
>> picture. 
>>
>> The python manage.py runserver show:
>> [27/Jun/2012 21:36:19] "GET /admin/css/base.css HTTP/1.1" 404 4468
>> [27/Jun/2012 21:36:19] "GET 
>> /admin/jquery/ui/css/custom-**theme/jquery-ui-1.8.custom.css 
>> HTTP/1.1" 404 4585
>> [27/Jun/2012 21:36:19] "GET /admin/css/jquery-ui-**grappelli-extensions.css 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:19] "GET /admin/jquery/jquery-1.6.2.**min.js 
>> HTTP/1.1" 404 4510
>> [27/Jun/2012 21:36:19] "GET 
>> /admin/jquery/ui/js/jquery-ui-**1.8.15.custom.min.js 
>> HTTP/1.1" 404 4561
>> [27/Jun/2012 21:36:19] "GET /admin/js/grappelli/grappelli.**js HTTP/1.1" 
>> 404 4507
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_collapsible.js 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_timepicker.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_collapsible_group.js 
>> HTTP/1.1" 404 4564
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_fk.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_m2m.js 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_related_generic.js 
>> HTTP/1.1" 404 4558
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_fk.js 
>> HTTP/1.1" 404 4558
>> [27/

Re: django 1.4 + grappelli 2.4: missing css, img files.

2012-06-28 Thread bruce
Thank!!
It works! 
I checked the grappelli's admin base file:
/usr/local/lib/python2.6/dist-packages/grappelli/templates/admin/base.html
It shows that the grappelli is using {% admin_media_prefix %}.  
 

The DeprecationWarning message made me confused. 

Thanks!!



On Thursday, June 28, 2012 3:04:25 AM UTC-4, Karl Sutt wrote:
>
> Ali,
>
> Given that your static directory is STATIC_URL = '/static/' and 
> STATIC_ROOT is something like os.path.join(PROJECT_PATH, "static"), add
>
>> ADMIN_MEDIA_PREFIX = '/static/grappelli/' (or whatever your static 
>> directory is) to your settings.py
>
>
> That should do the trick. 
>
> Tervitades/Regards
> Karl Sutt
>
>
> On Thu, Jun 28, 2012 at 5:07 AM, bruce  wrote:
>
>> Dear All,
>>
>> I know this problem is related with grappelli. But it may be a django 
>> configure problem. So I am posting my question here.
>> If it is inappropriate, please let me know. 
>>
>> I followed the django 1.4's tutorial to setup the 'polls' app and it was 
>> successful.
>> I also followed the grappelli 2.4 quick start guide. 
>> http://django-grappelli.**readthedocs.org/en/grappelli_**
>> 2_4/quickstart.html<http://django-grappelli.readthedocs.org/en/grappelli_2_4/quickstart.html>
>>
>> I followed every step and didn't do anything else. 
>> The last command is:
>> python manage.py collectstatic
>> After this command is executed, two new directories were created(admin 
>> and grappelli).
>>
>> The directory is as follows:
>>  root@ubuntu:/home/hduser/**django/mysite# pwd
>> /home/hduser/django/mysite
>> root@ubuntu:/home/hduser/**django/mysite# ls
>> admin  grappelli  manage.py  mysite  mytemplate  polls
>>
>> Finally, 
>> I can access the http://127.0.0.1:8000/**admin<http://127.0.0.1:8000/admin>
>> But, the css,img files are missing. Please see the attached screen shot 
>> picture. 
>>
>> The python manage.py runserver show:
>> [27/Jun/2012 21:36:19] "GET /admin/css/base.css HTTP/1.1" 404 4468
>> [27/Jun/2012 21:36:19] "GET 
>> /admin/jquery/ui/css/custom-**theme/jquery-ui-1.8.custom.css 
>> HTTP/1.1" 404 4585
>> [27/Jun/2012 21:36:19] "GET /admin/css/jquery-ui-**grappelli-extensions.css 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:19] "GET /admin/jquery/jquery-1.6.2.**min.js 
>> HTTP/1.1" 404 4510
>> [27/Jun/2012 21:36:19] "GET 
>> /admin/jquery/ui/js/jquery-ui-**1.8.15.custom.min.js 
>> HTTP/1.1" 404 4561
>> [27/Jun/2012 21:36:19] "GET /admin/js/grappelli/grappelli.**js HTTP/1.1" 
>> 404 4507
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_collapsible.js 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_timepicker.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_collapsible_group.js 
>> HTTP/1.1" 404 4564
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_fk.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_m2m.js 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_related_generic.js 
>> HTTP/1.1" 404 4558
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_fk.js 
>> HTTP/1.1" 404 4558
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_m2m.js 
>> HTTP/1.1" 404 4561
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_generic.js 
>> HTTP/1.1" 404 4573
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_timepicker.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_fk.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_m2m.js 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_related_generic.js 
>> HTTP/1.1" 404 4558
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_fk.js 
>> HTTP/1.1" 404 4558
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_m2m.js 
>> HTTP/1.1" 404 4561
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_generic.js 
>

Django-Grappelli...... customize the admin/base_site.html

2012-07-01 Thread bruce
Dear All,

Before Grappelli is installed, I can simply create a customized 
admin/base_site.html to override the default admin/base_site.html. 

After the Grappelli is installed, I failed to do it.  
Is there any way I can customize the base_site.html file? or, 
is there any links for additional knowledge I need to read? 

Thanks!!
Bruce

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/7Q-F39P9k7EJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



[sorl thumbnail] get_thumbnail not working -- IOError

2012-07-19 Thread bruce
Dear All,

I am trying to use the ImageField in my model, and use get_thumbnail in the 
forms.py. 
The problem is:
If I don't use get_thumbnail, it works well. The image was uploaded 
successfully and the thumbnail shows on the admin page. It works well.
However, If I try to use the get_thumbnail to rescale the image, it fails. 

IOError at /admin/labcv/person/2/

[Errno 2] No such file or directory: u'/root/django/mysite_new/media/www.jpg'

Request Method:POSTRequest 
URL:http://192.168.1.1:8000/admin/labcv/person/2/Django 
Version:1.4Exception Type:IOErrorException Value:

[Errno 2] No such file or directory: u'/root/django/mysite_new/media/www.jpg'







Here is my code snippet:

models.py
Class Person(models.Model):
   
  photo = *ImageField*(upload_to = 'images/', null=True, blank=True)
   ..

forms.py

class PersonAdminForm(ModelForm):
class Meta:
model = Person

def clean_photo(self):
image = self.cleaned_data.get('photo', False)
if image:
*t = get_thumbnail(image, "400x400")   # I add this additional 
line to test get_thumbnail.  If I remove this line, it works well. 
*return image
else:
raise ValidationError("You must upload your photo")


admin.py

class PersonAdmin(*AdminImageMixin*, admin.ModelAdmin):
form = PersonAdminForm
inlines = [SectionInline]


settings.py

THUMBNAIL_DEBUG = True

MEDIA_ROOT = SITE_ROOT + '/../media/'
MEDIA_URL = '/media/'
STATIC_ROOT = ''
STATIC_URL = '/static/'

my directory tree is as follows:
.
├── labcv
│   ├── admin.py
│   ├── admin.pyc
│   ├── forms.py
│   ├── forms.pyc
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── models.py
│   ├── models.pyc
│   ├── static
│   │   ├── images
│   │   │   └── hi.png
│   │   └── scripts
│   │   └── functions.js
│   ├── templatetags
│   │   ├── __init__.py
│   │   ├── __init__.pyc
│   │   ├── labcv_tags.py
│   │   └── labcv_tags.pyc
│   ├── tests.py
│   ├── views.py
│   └── views.pyc
├── manage.py
├── media
│   ├── cache
│   │   ├── 0f
│   │   │   └── c9
│   │   │   └── 0fc9272233811b5b630f568c452a7827.jpg
│   │   ├── 17
│   │   │   └── 11
│   │   │   └── 1711bafea9d8da8572cfe3f3be01506b.jpg
│   │   ├── 26
│   │   │   └── ae
│   │   │   └── 26aec38ff13d7db7aa9ba0b954a1a10b.jpg
│   │   ├── 81
│   │   │   └── ac
│   │   │   └── 81ac76c08c643711916b282e9bbee43b.jpg
│   │   └── d8
│   │   └── e5
│   │   └── d8e556ad6da2c24ff464a40ae671fd13.jpg
│   └── images
│   ├── a.JPG
│   ├── a.png
├── mysite
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── logfile
│   ├── settings.py
│   ├── settings.pyc
│   ├── urls.py
│   ├── urls.pyc
│   ├── wsgi.py
│   └── wsgi.pyc
└── mytemplates
├── admin
│   ├── base_site.html
│   └── labcv
│   ├── person
│   └── section
│   └── change_form.html.bad
└── labcv
├── detail.html
├── index.html
└── items.html

Please help! 
any suggestions? 
any links for the corresponding knowledge? 

Thanks!!








-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/dj2t8cHevWEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [sorl thumbnail] get_thumbnail not working -- IOError

2012-07-19 Thread bruce
oh. 
I forgot the complete error message:

IOError at /admin/labcv/person/2/

[Errno 2] No such file or directory: u'/root/django/mysite_new/media/www.jpg'

Request Method:POSTRequest 
URL:http://192.168.1.1:8000/admin/labcv/person/2/Django 
Version:1.4Exception Type:IOErrorException Value:

[Errno 2] No such file or directory: u'/root/django/mysite_new/media/www.jpg'

Exception 
Location:/usr/local/lib/python2.6/dist-packages/django/core/files/storage.py 
in _open, line 156Python Executable:/usr/bin/pythonPython Version:2.6.5Python 
Path:

['/root/django/mysite_new',
 '/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/mypy-0.256-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/WebError-0.10.3-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/sqlbean-0.603-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/hmako-1.12-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/decorator-3.3.3-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/Paste-1.7.5.1-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/Pygments-1.5-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/Tempita-0.5.1-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/WebOb-1.2-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/DBUtils-1.1-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/pip-1.1-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/django_grappelli-2.4.0a1-py2.6.egg',
 '/usr/local/lib/python2.6/dist-packages/python_memcached-1.48-py2.6.egg',
 '/root/django/mysite_new',
 '/root/ddt/debug_toolbar',
 '/root/ddt',
 '/root/django/sorl_thumbnail',
 '/usr/lib/python2.6',
 '/usr/lib/python2.6/plat-linux2',
 '/usr/lib/python2.6/lib-tk',
 '/usr/lib/python2.6/lib-old',
 '/usr/lib/python2.6/lib-dynload',
 '/usr/lib/python2.6/dist-packages',
 '/usr/lib/python2.6/dist-packages/PIL',
 '/usr/lib/python2.6/dist-packages/gst-0.10',
 '/usr/lib/pymodules/python2.6',
 '/usr/lib/python2.6/dist-packages/gtk-2.0',
 '/usr/lib/pymodules/python2.6/gtk-2.0',
 '/usr/local/lib/python2.6/dist-packages']

Server time:Thu, 19 Jul 2012 22:43:44 -0400

...
..

   - /root/django/mysite_new/labcv/forms.py in clean_photo
   1. 
  
t = get_thumbnail(image, "400x400")
  
  ...
   ▶ Local vars 
   - /root/django/sorl_thumbnail/sorl/thumbnail/shortcuts.py in 
   get_thumbnail
   1. 
  
  return default.backend.get_thumbnail(file_, geometry_string, 
**options)
  
  ...
   ▶ Local vars 
   - /root/django/sorl_thumbnail/sorl/thumbnail/base.py in get_thumbnail
   1. 
  
  source_image = default.engine.get_image(source)
  
  ...
   ▶ Local vars 
   - /root/django/sorl_thumbnail/sorl/thumbnail/engines/pil_engine.py in 
   get_image
   1. 
  
  buf = StringIO(source.read())
  
  ...
   ▶ Local vars 
   - /root/django/sorl_thumbnail/sorl/thumbnail/images.py in read
   1. 
  
  return self.storage.open(self.name).read()
  
  ...
   ▶ Local vars 
   - /usr/local/lib/python2.6/dist-packages/django/core/files/storage.py in 
   open
   1. 
  
  return self._open(name, mode)
  
  ...
   ▶ Local vars 
   - /usr/local/lib/python2.6/dist-packages/django/core/files/storage.py in 
   _open
   1. 
  
  return File(open(self.path(name), mode))
  
  ...
   ▶ Local vars 
   



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Uk2Ol4QM0qEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



[old question]NoReverseMatch.. I am sorry.

2012-08-17 Thread bruce
I am sorry I know this is an old topics. 
But I spent the whole day and still unable to fix this problem. 

NoReverseMatch at /1/

Reverse for ''blog.views.add_comment'' with arguments '(1L,)' and keyword 
arguments '{}' not found.

Request Method:GETRequest URL:http://192.168.71.58:8007/1/Django 
Version:1.4Exception 
Type:NoReverseMatchException Value:

Reverse for ''blog.views.add_comment'' with arguments '(1L,)' and keyword 
arguments '{}' not found.






The following is my urls.py


urlpatterns = patterns('',
  
url(r'^admin/', include(admin.site.urls)),
url(r'^(\d+)/$', 'blog.views.post'),
url(r'^add_comment/(\d+)/', 'blog.views.add_comment'),

)




my tempalte:

{% 
csrf_token %}

Name: {{ form.author }}
{{ form.body|linebreaks }}







I tested the add_comment, it seems works.
http://192.168.71.58:8007/add_comment/1/ 
It works. 



any idea? 
Thanks!!!



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/8gp14fMRhO4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [old question]NoReverseMatch.. I am sorry.

2012-08-17 Thread bruce
Tears
thanks!

But I am confused.
For example,
the following code needs to add single quote. 

{% block content %}
Add Todo items


Is there a link to give me detailed description?
I want to learn it and never get stuck again. 

Thanks!!



On Friday, August 17, 2012 5:37:13 PM UTC-4, Tomas Neme wrote:
>
> either remove the quotes from {% url 'blog.views.add_comment' %} (so it's 
> {% url blog.views.add_comment %}) or {% load url from future %}
>
> Loading from future is the better option, I think.
>
> and for future reference:
>
> Reverse for ''blog.views.add_comment'' with arguments '(1L,)' and keyword 
> arguments '{}' not found.
>
> notice how there's two single quotes there, not a double quote? that's 
> your clue, right there
>
> -- 
> "The whole of Japan is pure invention. There is no such country, there are 
> no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/) 
> (='.'=)This is Bunny. Copy and paste bunny  
> (")_(") to help him gain world domination.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/QqYvLl3VNisJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [old question]NoReverseMatch.. I am sorry.

2012-08-17 Thread bruce
Thanks.
I am going to read it. 
Have a great weekend!



On Friday, August 17, 2012 6:30:26 PM UTC-4, Tomas Neme wrote:
>
> > But I am confused. 
> > For example, 
> > the following code needs to add single quote. 
> > 
> > {% block content %} 
> > Add Todo items 
>
> https://docs.djangoproject.com/en/dev/releases/1.3/#changes-to-url-and-ssi 
>
> also, that won't work with double quotes either, unless you import 
> future, and a bunch of other things. 
>
> Just import url from future, since this will be the default behavior 
> in the near future 
>
> -- 
> "The whole of Japan is pure invention. There is no such country, there 
> are no such people" --Oscar Wilde 
>
> |_|0|_| 
> |_|_|0| 
> |0|0|0| 
>
> (\__/) 
> (='.'=)This is Bunny. Copy and paste bunny 
> (")_(") to help him gain world domination. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/L9UncMhe4BQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [old question]NoReverseMatch.. I am sorry.

2012-08-18 Thread bruce
Thanks!!
It is very helpful!!

Have a great weekend! 

On Friday, August 17, 2012 6:29:06 PM UTC-4, Kurtis wrote:
>
> In this case, you are using a 'named URL' in the Admin namespace. Here's 
> two links that may help you learn a bit more about this topic.
>
> https://docs.djangoproject.com/en/dev/topics/http/urls/#naming-url-patterns
>
> https://docs.djangoproject.com/en/dev/topics/http/urls/#defining-url-namespaces
>
> https://docs.djangoproject.com/en/dev/topics/http/urls/#topics-http-reversing-url-namespaces
>
> On Fri, Aug 17, 2012 at 6:23 PM, bruce  >wrote:
>
>> Tears
>> thanks!
>>
>> But I am confused.
>> For example,
>> the following code needs to add single quote. 
>>
>> {% block content %}
>> Add Todo items
>>
>>
>> Is there a link to give me detailed description?
>> I want to learn it and never get stuck again. 
>>
>> Thanks!!
>>
>>
>>
>>
>> On Friday, August 17, 2012 5:37:13 PM UTC-4, Tomas Neme wrote:
>>>
>>> either remove the quotes from {% url 'blog.views.add_comment' %} (so 
>>> it's {% url blog.views.add_comment %}) or {% load url from future %}
>>>
>>> Loading from future is the better option, I think.
>>>
>>> and for future reference:
>>>
>>> Reverse for ''blog.views.add_comment'' with arguments '(1L,)' and keyword 
>>> arguments '{}' not found.
>>>
>>> notice how there's two single quotes there, not a double quote? that's 
>>> your clue, right there
>>>
>>> -- 
>>> "The whole of Japan is pure invention. There is no such country, there 
>>> are no such people" --Oscar Wilde
>>>
>>> |_|0|_|
>>> |_|_|0|
>>> |0|0|0|
>>>
>>> (\__/) 
>>> (='.'=)This is Bunny. Copy and paste bunny  
>>> (")_(") to help him gain world domination.
>>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/QqYvLl3VNisJ.
>>
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@googlegroups.com .
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/KsoT7HeKWpIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



[need advice and suggestion] questions about generating static web page.

2012-09-25 Thread bruce
Dear All,

I am a novice. 
Currently, 
I am thinking to build a simple static personal web page generator for the 
people in my group. So, they can login my django powered site and input 
their info, such as name, title, photo, education background and etc. Then, 
the person's static web page will be generated automatically. I know I can 
use some advanced tools, such as DreamWeaver and frontpage editor, to get 
it done. However, I prefer to use my freshly learned knowledge to build a 
cms-like site to automatically generate the static web pages. 

Currently, the site has been done. But I am stuck with a new problem. The 
static web page doesn't have HTML tables. 
For example, person A need a table(5 rows x 3 columns), person B needs a 
table(2 rows x 2 columns). 

do you have any suggestion? 
What kind of topic should I go to google? 
or, do you have any recommendation? django-cms? 

Thanks All!
Bruce





-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/i4S-nK72vP0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



questions about generating static web page.

2012-09-25 Thread bruce
God. The original subject is too long. 
I made the Subject shorter. 

Thanks,
Bruce




On Tuesday, September 25, 2012 2:11:45 PM UTC-4, bruce wrote:
>
> Dear All,
>
> I am a novice. 
> Currently, 
> I am thinking to build a simple static personal web page generator for the 
> people in my group. So, they can login my django powered site and input 
> their info, such as name, title, photo, education background and etc. Then, 
> the person's static web page will be generated automatically. I know I can 
> use some advanced tools, such as DreamWeaver and frontpage editor, to get 
> it done. However, I prefer to use my freshly learned knowledge to build a 
> cms-like site to automatically generate the static web pages. 
>
> Currently, the site has been done. But I am stuck with a new problem. The 
> static web page doesn't have HTML tables. 
> For example, person A need a table(5 rows x 3 columns), person B needs a 
> table(2 rows x 2 columns). 
>
> do you have any suggestion? 
> What kind of topic should I go to google? 
> or, do you have any recommendation? django-cms? 
>
> Thanks All!
> Bruce
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/r7or5qkzDaIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: questions about generating static web page.

2012-09-25 Thread bruce
Thanks!!
Yes. This is exact what I did. 
Actually, I finish this in the admin template. 
But my question is:
the template may contain some tables. 
These tables may have different number of rows and columns. 


so, in the model, 
there will be an additional class mytable. 
mytable should contain the number of rows and columns. mytable also needs 
to contain the content to fill the table. 
is there an existing modules for the table? How can I implement to allow 
the template show different size of tables. 

Thanks,
Ming






On Tuesday, September 25, 2012 2:46:21 PM UTC-4, Amyth wrote:
>
> What do you mean by generating a Static HTML page for each user?
>
> From what i understand you can simply have a profile layout's html 
> template and use simple template tags to retrieve user data.
>
> For example:
>
> 1. Define a UserData class in your models.py that will basically store all 
> the user data.
> 2. Then in Views.py create a view that uses a username or user id to get 
> data, something like this:
>
> #imports
> from models import UserData
>
>
> def user_profile(request, userid):
>   userdata = UserData.objects.filter(userid=1)
>   return render_to_response('profile.html', {'userdata': userdata}, 
> context_instance=RequestContext(request))
>
> 3. You can use named 
> groups<https://docs.djangoproject.com/en/dev/topics/http/urls/#named-groups> 
> to 
> pass the userid to the view. Something like this,
>
> urlpatterns += patterns('',
>   (r'^users/(?P.+?)/$', 'views.user_profile'),
> )
>
> 4. Then in the template you can use for loop template tag like
>
> {% if userdata %}
>   userdata.username
>   
> 
> Example Field:
> userdata.example_field
> 
>   
> {% endif %}
>
>
>
>
>
> On Tue, Sep 25, 2012 at 11:44 PM, bruce  >wrote:
>
>> God. The original subject is too long. 
>> I made the Subject shorter. 
>>
>> Thanks,
>> Bruce
>>
>>
>>
>>
>>
>> On Tuesday, September 25, 2012 2:11:45 PM UTC-4, bruce wrote:
>>>
>>> Dear All,
>>>
>>> I am a novice. 
>>> Currently, 
>>> I am thinking to build a simple static personal web page generator for 
>>> the people in my group. So, they can login my django powered site and input 
>>> their info, such as name, title, photo, education background and etc. Then, 
>>> the person's static web page will be generated automatically. I know I can 
>>> use some advanced tools, such as DreamWeaver and frontpage editor, to get 
>>> it done. However, I prefer to use my freshly learned knowledge to build a 
>>> cms-like site to automatically generate the static web pages. 
>>>
>>> Currently, the site has been done. But I am stuck with a new problem. 
>>> The static web page doesn't have HTML tables. 
>>> For example, person A need a table(5 rows x 3 columns), person B needs a 
>>> table(2 rows x 2 columns). 
>>>
>>> do you have any suggestion? 
>>> What kind of topic should I go to google? 
>>> or, do you have any recommendation? django-cms? 
>>>
>>> Thanks All!
>>> Bruce
>>>
>>>
>>>
>>>
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/r7or5qkzDaIJ.
>>
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@googlegroups.com .
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> -- 
> Thanks & Regards
> 
>
> Amyth [Admin - Techstricks]
> Email - aroras@gmail.com , ad...@techstricks.com
> Twitter - @mytharora
> http://techstricks.com/
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/JoXemRfP_f4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: questions about generating static web page.

2012-09-25 Thread bruce
Thanks very much!
Let me post the class in my models.py

so, in the models.py, there are three classes: person, section and item. 
a person has several sections. each section contains several items. 

class Person
   ..

class Section(models.Model):
person = models.ForeignKey(Person)
section_headings = models.CharField(blank=True,max_length=100)
..(also contains some fields for sorting and etc.)

  
class Item(models.Model):
section = models.ForeignKey(Section)
item_text = models.TextField()
...(also contains some fields for sorting and etc.)

The item is pretty simple. 
but if I am going to create a html table. what I can do. 
One way I can image is:
I am going to add a new class named Table. 

class Table(models.Model):
   section = models.ForeignKey(Section)

class Row(models.Model):
table = models.ForeignKey(Table).
..

class Cell(models.Model):
row = models.ForeignKey(Row)
.


Do you think is there any better way to do this? 

Thanks!!
Bruce

  



  





On Tuesday, September 25, 2012 4:15:25 PM UTC-4, ke1g wrote:
>
> I, and probably others, would need a more detailed description of 
> these tables and how they are to be used, before we could offer help 
> on them. 
>
> On Tue, Sep 25, 2012 at 3:22 PM, bruce > 
> wrote: 
> > Thanks!! 
> > Yes. This is exact what I did. 
> > Actually, I finish this in the admin template. 
> > But my question is: 
> > the template may contain some tables. 
> > These tables may have different number of rows and columns. 
> > 
> > 
> > so, in the model, 
> > there will be an additional class mytable. 
> > mytable should contain the number of rows and columns. mytable also 
> needs to 
> > contain the content to fill the table. 
> > is there an existing modules for the table? How can I implement to allow 
> the 
> > template show different size of tables. 
> > 
> > Thanks, 
> > Ming 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Tuesday, September 25, 2012 2:46:21 PM UTC-4, Amyth wrote: 
> >> 
> >> What do you mean by generating a Static HTML page for each user? 
> >> 
> >> From what i understand you can simply have a profile layout's html 
> >> template and use simple template tags to retrieve user data. 
> >> 
> >> For example: 
> >> 
> >> 1. Define a UserData class in your models.py that will basically store 
> all 
> >> the user data. 
> >> 2. Then in Views.py create a view that uses a username or user id to 
> get 
> >> data, something like this: 
> >> 
> >> #imports 
> >> from models import UserData 
> >> 
> >> 
> >> def user_profile(request, userid): 
> >>   userdata = UserData.objects.filter(userid=1) 
> >>   return render_to_response('profile.html', {'userdata': userdata}, 
> >> context_instance=RequestContext(request)) 
> >> 
> >> 3. You can use named groups to pass the userid to the view. Something 
> like 
> >> this, 
> >> 
> >> urlpatterns += patterns('', 
> >>   (r'^users/(?P.+?)/$', 'views.user_profile'), 
> >> ) 
> >> 
> >> 4. Then in the template you can use for loop template tag like 
> >> 
> >> {% if userdata %} 
> >>   userdata.username 
> >>
> >>  
> >> Example Field: 
> >> userdata.example_field 
> >>  
> >>
> >> {% endif %} 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> On Tue, Sep 25, 2012 at 11:44 PM, bruce  wrote: 
> >>> 
> >>> God. The original subject is too long. 
> >>> I made the Subject shorter. 
> >>> 
> >>> Thanks, 
> >>> Bruce 
> >>> 
> >>> 
> >>> 
> >>> 
> >>> 
> >>> On Tuesday, September 25, 2012 2:11:45 PM UTC-4, bruce wrote: 
> >>>> 
> >>>> Dear All, 
> >>>> 
> >>>> I am a novice. 
> >>>> Currently, 
> >>>> I am thinking to build a simple static personal web page generator 
> for 
> >>>> the people in my group. So, they can login my django powered site and 
> input 
> >>>> their info, such as name, title, photo, education background and etc. 
> Then, 
> >>>> the person's static web page will be generated automatically. I know 
> I can 
> >>>> use some advanced tools, such as D

Re: API with django

2010-05-24 Thread Bruce Wang
2010/5/24 Alexandre González 

> Hi!
>
> I must develop a django app that receives XML and returns XML.
>
> What's the best way to do this? Create a view that receive the XML and
> parse it to return a template with the XML resultant?
>
> I'm newbie in django and need your tips :)
>
>
>
You may want to try django-piston [1], a RESTful API app for django,
bitbucket.org itself is also using piston

[1] http://bitbucket.org/jespern/django-piston/wiki/Home

-- 
simple is good
http://brucewang.net
http://twitter.com/number5

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unable to import libxml2mod from the python script

2010-06-02 Thread Bruce Wang
On Thu, Jun 3, 2010 at 12:38 PM, Superman  wrote:

> Thanks for your reply. How do you check env path variables diff
> between shell and code
> execution?
>
> To my wsgi file, I have this line "#!/usr/local/bin/python" which
> tells which interpreter to use. And yes, libxml2.py and libxml2mod.so
> files are there in "/usr/local/lib/python2.5/site-packages/" folder.
> Also running ldd on libxml2mod.so outputs:
>
> libxml2.so.2 => /usr/local/lib/libxml2.so.2 (0x2b5368ebe000)
>

Are you running your django app under mod_wsgi? It may not running with your
interpreter in your #! line.

Try using
import sys; print sys.executable
in your wsgi file to find out the exact interpreter your wsgi server is
using.

BTW: I would suggest you to look at lxml[1] which is another libxml2/libxslt
binding but more elegant and pythonic.

[1] http://codespeak.net/lxml/

-- 
simple is good
http://brucewang.net
http://twitter.com/number5

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unable to import libxml2mod from the python script

2010-06-02 Thread Bruce Wang
On Thu, Jun 3, 2010 at 1:26 PM, Graham Dumpleton  wrote:

>
> >
> > Are you running your django app under mod_wsgi? It may not running with
> your
> > interpreter in your #! line.
> >
> > Try using
> > import sys; print sys.executable
> > in your wsgi file to find out the exact interpreter your wsgi server is
> > using.
>
> No it will not. Under mod_python and mod_wsgi that is usually going to
> be 'httpd' executable.
>
> More important value is 'sys.prefix', plus running 'ldd' on the .so
> file for the Apache module.
>
> Graham
>
>
Oops, sorry about giving out wrong instructions.



-- 
simple is good
http://brucewang.net
http://twitter.com/number5

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Modelform FileField

2008-05-29 Thread Bruce Dockeray

  I have a modelform bound to a table. One of the fields in the table is 
a FileField. I able to upload  files using the modelform and this works 
well.

  Once i have uploaded a file if i look at the database record using the 
modelform the FileField continues to display as a file upload widget and 
consequently the path&name of the file don't show. This is frustrating 
as i would like to be able to see this.  I wondered whether i could 
introduce a custom field onto the modelform and then set the value of 
the custom field to be the stored string value of the FileField ... but 
i can't work out how to set the value of the custom field !

Any ideas suggestions welcome ..

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: RedirectView with query_string = True and urlencoded unicode string

2012-05-14 Thread Andrew Bruce
You have passed 'anything' as a keyword argument that will get passed into
your view. Unfortunately, you can't access it in your inline constructor
call. Try subclassing RedirectView in views.py of your app.

class SubRedirectView(RedirectView):

query_string = True

def get_redirect_url(self, **kwargs):
return '/tmovil/planes/%s' % self.kwargs.get('anything', None)

~Drew


On Mon, May 14, 2012 at 2:30 PM, Sławek Ehlert  wrote:

>  As the error states:
> You don't have a format argument in your '/tmovil/planes/%(anything)s'
> string.
>
> Cheers
>
> Dnia 14.05.2012 23:19, Germán napisał(a):
>
> Hi. Please excuse my ignorance in this affairs.
>
>  For an specific 
> URI,
> I have the following error
>
> Traceback (most recent call last):
>
>
>
> File 
> "/usr/local/lib/python2.6/**dist-packages/django/core/**handlers/base.py",
> line 111, in get_response
>response = callback(request, *callback_args, **callback_kwargs)
>
>   File 
> "/usr/local/lib/python2.6/**dist-packages/django/views/**generic/base.py",
> line 47, in view
>return self.dispatch(request, *args, **kwargs)
>
>   File 
> "/usr/local/lib/python2.6/**dist-packages/django/views/**generic/base.py",
> line 68, in dispatch
>return handler(request, *args, **kwargs)
>
>   File 
> "/usr/local/lib/python2.6/**dist-packages/django/views/**generic/base.py",
> line 151, in get
>url = self.get_redirect_url(kwargs)
>
>   File 
> "/usr/local/lib/python2.6/**dist-packages/django/views/**generic/base.py",
> line 146, in get_redirect_url
>return url % kwargs
>
>  TypeError: not enough arguments for format string
>
>
>  The version I use is 1.3.1, and the urls.py line determining the
> redirection is
>
>
> (r'^planes/((?P.*))', 
> RedirectView.as_view(url='/tmovil/planes/%(anything)s', query_string=True)),
>
>
>  Is it possible the bug reported in ticket 
> 16842is cause for this error? If 
> not, should I file a bug?
>
>  Thanks
>
> On Saturday, August 13, 2011 12:47:30 AM UTC-4, Karen Tracey wrote:
>>
>> On Thu, Aug 11, 2011 at 10:48 AM, Slafs  wrote:
>>
>>> Should i report a ticket?
>>>
>>
>> Yes please, that's a bug in Django.
>>
>> Karen
>>  --
>> http://tracey.org/kmt/
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/SebYILZBuMAJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django1.5 subclass AbstractUser, How to get a password-(re)set field in admin

2012-11-30 Thread Bruce Wade
Hi Russ,

Thanks that did solve the problem I was having.

--
Regards,
Bruce


On Fri, Nov 30, 2012 at 9:32 PM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> Hi Bruce,
>
> Update your Django checkout. This problem was fixed in 0fc5878c.
>
> Yours,
> Russ Magee %-)
>
>
> On Fri, Nov 30, 2012 at 2:07 PM, Detectedstealth wrote:
>
>> Hi Russel,
>>
>> I have followed
>> https://docs.djangoproject.com/en/dev/topics/auth/#a-full-example then
>> added:
>>
>> password = ReadOnlyPasswordHashField(label=_("Password"),
>>
>> help_text=_("Raw passwords are not stored, so there is no way to
>> see "
>>
>> "this user's password, but you can change the
>> password "
>>
>> "using this form."),
>> widget=ReadOnlyPasswordHashWidget())
>>
>> From what I seen in django/contrib/auth/forms UserChangeForm this gives
>> me the change password URL however I get the error: 'CustUser' object has
>> no attribute 'username' looking at the error line 136
>>
>> /Library/Python/2.7/site-packages/django/contrib/auth/admin.py in
>> user_change_password
>>
>>1. 'title': _('Change password: %s') %
>>escape(user.username),
>>
>> It looks like this is either a bug or doesn't work with a custom user as
>> planed as it looks for a username even though in the example you set the
>> email to username field with: USERNAME_FIELD = 'email'
>>
>> Am I missing something?
>>
>> Regards,
>> Bruce
>>
>> On Saturday, November 3, 2012 4:09:09 PM UTC-7, Russell Keith-Magee wrote:
>>
>>>
>>> On Sat, Nov 3, 2012 at 11:15 PM, Michael Muster <
>>> michael...@googlemail.com**> wrote:
>>>
>>>> Hi again,
>>>>
>>>> I have a subclass from AbstractUser
>>>>
>>>> 1 from django.contrib.auth.models import AbstractUser
>>>> 2 from django.conf import settings
>>>> 3
>>>> 4 class cpUser(AbstractUser):
>>>> 5 twitter = models.CharField(max_length=**100)
>>>> 6 def __unicode__(self):
>>>> 7 return self.username
>>>>
>>>> and
>>>> AUTH_USER_MODEL = 'account.cpUser'
>>>> in my settings.py set.
>>>>
>>>> How do i get a password field to set and reset
>>>> a password in my admin app?
>>>> Adding the password field to admin.py does obviously not
>>>> work as it enters plain text and not the hashed password.
>>>>
>>>> 1 from django.contrib import admin
>>>> 2 class cpUserAdmin(admin.ModelAdmin):
>>>> 3fields = ['twitter','username', 'first_name', 'last_name',
>>>> 'password',]
>>>> 4
>>>>  
>>>> 5 admin.site.register(cpUser, cpUserAdmin)
>>>>
>>>>
>>>> Do i have to set a passwort field to the models.py or
>>>> can i geht that from the models which i "abstracted" from
>>>> (as done with username, first_name, last_name...)
>>>>
>>>> You need to follow the instructions that are in the documentation.
>>>
>>> https://docs.djangoproject.**com/en/dev/topics/auth/#**
>>> custom-users-and-django-**contrib-admin<https://docs.djangoproject.com/en/dev/topics/auth/#custom-users-and-django-contrib-admin>
>>>
>>> The key is that you can't just subclass admin.ModelAdmin -- you need to
>>> subclass the existing Django admin class for Users
>>> (django.contrib.auth.admin.**UserAdmin) - that base class is what
>>> provides all the special password handling etc for User models.
>>>
>>> Yours,
>>> Russ Magee %-)
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/sRmpO1m1Ng0J.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Pyjamas and django server setup - how do *you* do it?

2011-08-02 Thread Bruce Dou
Why there is not a default user login, user register template?
And Can not find some examples.

What is your advice to create user auth pages?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



About user auth page

2011-08-02 Thread Bruce Dou
Why there is not a default user login, user register template?
And Can not find some examples.

What is your advice to create user auth pages?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django for a front end designer

2011-08-03 Thread Bruce Dou
Or you can try Rails.

On Wed, Aug 3, 2011 at 4:15 PM, Andre Lopes  wrote:

> If you want to start with a PHP Framework, consider CodeIgniter. It is
> the easier Framework for a starter.
>
>
> On Tue, Aug 2, 2011 at 3:46 PM, paulo couto  wrote:
> > Ok thanks for the clarifications :
> > I guess i'll go to PHP for now and when i have more prog. experience i'll
> > try python and django to be able to build my own stuff from scratch.
> > Now i only need to find where to start in PHP :)
> > Thanks all for your time.
> >
> > 2011/8/2 webcomm 
> >>
> >> On Aug 2, 4:57 pm, "biofob...@gmail.com"  wrote:
> >> > Thank you all for the advices/sugestions.
> >> > For what i read most of you advice on PHP + framework and i can
> >> > understand that. I looked at django and rails as a option for me to
> >> > have. My PHP knowledge is very limited, and sometimes i need some
> >> > functionality on a wordpress site or on a textpattern one but my
> >> > knowledge doest allow me to do much. Thats when i "feel" i need to
> >> > learn some programing language in order to be able to do what i have
> >> > in mind.
> >>
> >> Writing a WordPress plugin might be a good initial goal for you.  It's
> >> been a while since I wrote one, but it's fairly easy if I remember
> >> right.  Though nothing's perfectly easy when you're just getting
> >> started.
> >>
> >> If you're going to start with a little PHP -- or regardless of the
> >> language you start with -- I would go to a physical bookstore, look
> >> through some books until you find something that makes sense to you,
> >> buy it, and then work up to writing a WordPress plugin (if you go
> >> PHP).
> >>
> >> Like I said, ultimately I think python may be a cut above PHP, but I
> >> think it would be a steep climb for various reasons not related to the
> >> language itself, and you wouldn't get much satisfaction for a while.
> >> And it wouldn't help you do custom work in WordPress, of course.
> >>
> >> If you do want to try Python at some point, I'd urge you to install
> >> Ubuntu (linux) on your computer and get comfortable with that first.
> >> It's much easier to do Python work in linux.  Plus, it's a great
> >> operating system.  I tried working with python on Windows XP for a
> >> long time, and that slowed me down a lot.  For PHP, I don't think the
> >> operating system matters quite as much.  If you want to do PHP in OSX,
> >> get XAMPP: http://www.apachefriends.org/en/xampp-macosx.html
> >>
> >> -Ryan
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Django users" group.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/django-users?hl=en.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
A decathlon Developer & programmer
http://blog.eood.cn/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-registration - stuck at Required templates topic

2011-08-04 Thread Bruce Dou
I also think that should be a default simple template in the package.

On Fri, Aug 5, 2011 at 12:52 PM, Phang Mulianto  wrote:

> well..like the error said..you need to put {% csrf_token %} inside your
> form.. do you read the tutorial? you should read it if you serious getting
> in django. . it helps you alot as it help me too..
> On Aug 5, 2011 12:12 PM, "bob gailer"  wrote:
> >
> >
> > On Aug 4, 11:47 pm, Mario Gudelj  wrote:
> >> Hey Bob,
> >>
> >> You can download some basic templates for this pagehttp://
> devdoodles.wordpress.com/2009/02/16/user-authentication-with-d...
> >
> > OK - did that - now what? I can get the login form displayed - when I
> > click get:
> >
> > Forbidden (403)
> >
> > CSRF verification failed. Request aborted.
> > Help
> >
> > Reason given for failure:
> >
> > CSRF token missing or incorrect.
> >
> >
> > In general, this can occur when there is a genuine Cross Site Request
> > Forgery, or when Django's CSRF mechanism has not been used correctly.
> > For POST forms, you need to ensure:
> >
> > The view function uses RequestContext for the template, instead of
> > Context.
> > In the template, there is a {% csrf_token %} template tag inside
> > each POST form that targets an internal URL.
> > If you are not using CsrfViewMiddleware, then you must use
> > csrf_protect on any views that use the csrf_token template tag, as
> > well as those that accept the POST data.
> >
> > I have no idea what to do with that message.
> >
> > I need a lot more hand-holding, since I am VERY new to django.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
A decathlon Developer & programmer
http://blog.eood.cn/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: What is the best server for Django

2011-03-09 Thread Bruce Dou
Linode or EC2.

On Wed, Mar 9, 2011 at 5:53 PM, Chen Xu  wrote:
> I am thinking to buy a server, and integrated with Django environment. So
> could anyone please give me some suggestions, which server is the best for
> this, amazon ec2 or?
>
> Thanks very much
> Best regards
>
> --
> ⚡ Chen Xu ⚡
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
A decathlon Drupal developer & programmer
http://blog.eood.cn/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Default auth with username but unique email, is it possible?

2015-01-26 Thread Bruce Li
Hi,

I'm using django's default auth settings in my app. All I want is to make 
email unique for each user. Is it possible to do that without creating a 
custom user model and user manager?


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/1a71b204-c675-494a-a9de-ca496a5015a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django default auth user but unique email

2015-01-26 Thread Bruce Li
Hi,

I want to build my user management based on default django users. But I 
want emails to be unique as well. Is it possible to do that without the 
need to create a custom user model and user managment?


Thanks,
- Bruce

-- 
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/990b575d-80aa-45e0-ab07-18011d2782d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django default auth user but unique email

2015-01-26 Thread Bruce Li
To be more specific, I want the username and email in default user model 
both to be unique and not blank.

On Tuesday, January 27, 2015 at 10:56:14 AM UTC+8, Bruce Li wrote:
>
> Hi,
>
> I want to build my user management based on default django users. But I 
> want emails to be unique as well. Is it possible to do that without the 
> need to create a custom user model and user managment?
>
>
> Thanks,
> - Bruce
>

-- 
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/e415b13a-2b38-4f1b-80e6-4ba808a09175%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django default auth user but unique email

2015-02-06 Thread Bruce Li
Thanks for your advice, I was too busy to reply. I will learn to use a 
custom model. Thanks.


On Tuesday, January 27, 2015 at 2:36:53 PM UTC+8, James Schneider wrote:
>
> If you want any sort of enforcement of a unique email address at the 
> database level, you'll need a custom user model. If you don't care about 
> that, all you'd need to do is override the user forms and create a custom 
> clean_email function that checks for duplicates before saving the form 
> data. Not 100% guaranteed on a high traffic site unless you wrap it in a 
> transaction, and will become expensive to check as you gather more users in 
> the database, especially since the email field won't be indexed using the 
> standard user model, and would result in a slower string-matching query 
> against the entire table rather than an index-based comparison.
>
> If you have any special requirements for the user in your application, I 
> highly recommend you bite the bullet and create a custom user model. It's 
> not terribly difficult, and will better posture you down the road in the 
> event that your requirements change, not to mention you can enforce 
> uniqueness at the database level. 
>
> -James
> On Jan 26, 2015 7:01 PM, "Bruce Li" > 
> wrote:
>
>> To be more specific, I want the username and email in default user model 
>> both to be unique and not blank.
>>
>> On Tuesday, January 27, 2015 at 10:56:14 AM UTC+8, Bruce Li wrote:
>>>
>>> Hi,
>>>
>>> I want to build my user management based on default django users. But I 
>>> want emails to be unique as well. Is it possible to do that without the 
>>> need to create a custom user model and user managment?
>>>
>>>
>>> Thanks,
>>> - Bruce
>>>
>>  -- 
>> 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/e415b13a-2b38-4f1b-80e6-4ba808a09175%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/e415b13a-2b38-4f1b-80e6-4ba808a09175%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dd69dcdb-607c-4377-b5b4-b24d5a63d1a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Best way to learn Django considering Python versions and etc.

2013-12-10 Thread Bruce Whealton
Hello all,
 So, I started looking at recommended reading on Django and a 
couple books referred me to first go through "The Definitive Guide To 
Django."  I have to admit some concern about reading a book on Django that 
is some 5 plus years old.  I've come to think of this as the information 
age and as such, anything over a certain number of years as being very 
problematic.  However, I did notice that the Bitnami Django stack does use 
Python 2.5 - the version I just downloaded... not even 2.7.x but 2.5.  
Another confusing thing is that the Bitnami Guide for what I 
just downloaded is radically different from what actually gets downloaded 
and setup.  I cannot even find the application or a similar folder to the 
app I created when I installed Django stack from Bitnami.  Even looking at 
the access_log was not very helpful. There are calls to /img/bitnami.png 
and a GET request to StartProject, which was the project name I chose 
during installation.  
   After trying to figure out this installation, I jumped back to 
"The Definitive Guide to Django" and jumping into chapter 2, I found 
success.  So. I'll probably move forward with the instructions in that text 
and hope that I'm not learning something outdated.  Again, this text is 
recommended as a prerequisite  for other texts, as it were.  
Any advice on this?   Has anyone had great success with Bitnami's Django 
stack?  
Here is another thing that has me a bit confused.  Coming from 
Drupal, Wordpress, etc, the thinking is that one should always get the 
latest version, at least the latest minor version, e.g. if running Drupal 
7.24 comes out and you are running Drupal 7.23, you are strongly encouraged 
to upgrade.  However, some of my reading and course work on Django 
discusses creating isolated environments that don't break when a new 
version is released.  What makes it such that if Django 1.65, or 1.7 comes 
out there is not an easy upgrade to the next latest edition without 
breaking things?  
   My intention is not to be critical, as I really like Python and 
Django.  Similar to learning Node.js and the specification of Dependencies, 
I have not read or found discussed in an online course, why one might not 
use the latest version of a dependency... or how one would be needing 
earlier versions of a dependency or a component of a framework.  
Thanks in advance for any advice,
Bruce 

-- 
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/0c2ac755-8bcb-40ec-8737-987e8b094ee0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Help with defining Models for ManyToMany and OneToMany relationships...

2016-04-23 Thread Bruce Whealton
Hello all,
  So, I setup django in a virtualenv on my Ubuntu environment.  I 
was reading the docs and thought I had things right 
for creating the 3 models I wanted with this application. I am using 
Postgresql.  I have the Postgresql driver for Python/Django installed
in the virtualenv.  It is a "Contacts" app.  
First question: Do django model fields default to required unless you use 
blank=True, null=True?
Many of my fields, I want to have optional.

I have a class called Contact, a class called Organization and a class 
called Connection.  
I wanted to use the Organization as a foreign key on the Contact model.  I 
could have more than one contact from
an Organization.  The Connection model is inspired by the Google Plus idea 
of "Circles" - e.g. friends,
family, following, etc.   So, this would be a many-to-many relationship.  

My problems are (1) I cannot create connections without specifying a 
contact.  
(2) If I was adding a contact using the admin interface, how do I allow no 
value for that foreign field
or allow for some kind of ajax type of text completion?  If a person is 
family or friend, I may not need
to list an Organization for them.
(3) I would like to support multiple connection types - e.g. following, 
employer, etc.

So, here is my apps models.py file:
>>>>

from django.db import models


class Contact(models.Model):
name = models.CharField(max_length=40)
Organization = models.CharField(max_length=50)
street_line1 = models.CharField("Street Line 1", max_length=50)
street_line2 = models.CharField("Street Line 2", max_length=50)
city = models.CharField(max_length=40)
state = models.CharField(max_length=40)
zipcode = models.CharField(max_length=20, blank=True, null=True)
phone1 = models.CharField(max_length=20)
phone2 = models.CharField(max_length=20)
email = models.EmailField(max_length=60)


class Organization(models.Model):
name = models.CharField(max_length=60)
street_line1 = models.CharField("Street Line 1", max_length=50)
street_line2 = models.CharField("Street Line 2", max_length=50)
city = models.CharField(max_length=40)
state = models.CharField(max_length=40)
zipcode = models.CharField(max_length=20, blank=True, null=True,)
phone = models.CharField(max_length=20)
email = models.EmailField(max_length=60)
website = models.URLField(max_length=90)
contact_name = models.ForeignKey(Contact, on_delete=models.CASCADE)


class Connection(models.Model):
type = models.CharField(max_length=60)
contact_name = models.ManyToManyField(Contact)   

>>>
Thanks in advance for any suggestions,
Bruce 

-- 
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/caede40b-640c-4e8d-997d-b76c62922c19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with defining Models for ManyToMany and OneToMany relationships...

2016-04-26 Thread Bruce Whealton
First I suggest to 
> use a different name for the field: type is a reserved Python word.
> Second, you can add choices to the field.
>
> from django.utils.translation import ugettext as _
> ...
> class Connection(models.Model):
> CHOICES = (('follower', _('Follower')),
>('employer', _('Employer')),
>('unspecified', _('Unspecified')),
>   )
> connection_type = models.CharField(max_length=20, choices=CHOICES)
> contact_name = models.ManyToManyField(Contact)  
>
> OK, that sounds great.  I debated over using choices but I can do a 
> migrate at any time to get the Choices to allow 
>
more options... which isn't a difficult migration as nothing is changing 
about the schema per se, just the values allowed in
Choices.
Thanks,
Bruce 

-- 
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/01c654a0-8d60-4d22-8282-c98dbb9ef1c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with defining Models for ManyToMany and OneToMany relationships...

2016-04-26 Thread Bruce Whealton
Mike,
 So, I tried your idea for reorganizing the models, and just 
removed Organization and instead setup
ContactOrOrganization as a class.  
It seemed to work ok, in terms of migrating fine.  However, the database 
now lacks a ContactsOrOrganization 
table.  
Oops, my mistake, it does have a table now for that model.  I wonder if I 
need a ForeignKey field in the ContactsOrOrganization table?
Bruce


Anyway, I will try to remove the ManyToMany statement from the Connections 
Model.  
I would then have one Contact or Organization maps to many Connection 
types.  

On Sunday, April 24, 2016 at 1:13:16 AM UTC-4, Mike Dewhirst wrote:
>
>
> I think you should rethink your Contact and Organization classes and see 
> if you can eliminate one or the other. A single table for both would 
> simplify the problem because the Connection class can implement as many 
> connections as you like. 
>
> For example ... 
>
> class ContactOrOrganization(etc): 
>  various detail fields ... 
>
> class Connection(etc): 
>  organization = ForeignKey("ContactOrOrganization", 
>  related_name="organization") 
>  contact = ForeignKey("ContactOrOrganization", 
>  related_name="contact") 
>
> Just because I used related_name that way means nothing. You can connect 
> contacts together or organizations together. Also, you can add other 
> fields to Connection with which to describe the relationship. 
>
> Mike 
>
> > I wanted to use the Organization as a foreign key on the Contact model. 
> > Â I could have more than one contact from 
> > an Organization. Â The Connection model is inspired by the Google Plus 
> > idea of "Circles" - e.g. friends, 
> > family, following, etc. Â  So, this would be a many-to-many 
> relationship. Â 
> > 
> > My problems are (1) I cannot create connections without specifying a 
> > contact. Â 
> > (2) If I was adding a contact using the admin interface, how do I allow 
> > no value for that foreign field 
> > or allow for some kind of ajax type of text completion? Â If a person is 
> > family or friend, I may not need 
> > to list an Organization for them. 
> > (3) I would like to support multiple connection types - e.g. following, 
> > employer, etc. 
> > 
> > So, here is my apps models.py file: 
> >  >>>> 
> > 
> > from django.db import models 
> > 
> > 
>
>

-- 
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/32dfa22a-0a55-4fdf-9da0-73152b1223aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with defining Models for ManyToMany and OneToMany relationships...

2016-04-26 Thread Bruce Whealton
Having followed all the suggestions, I am now stuck.  I have simplified the 
database by removing one model.  I get to the point of 
python manage.py makemigrations and it returns with what looks right. 
 However, the migrate command just throws out a bunch of errors.  For some 
reason,
it is looking at the choices variable field and telling me that 'following' 
is not an integer field.  From the directions I read, in similar posts, it 
seemed like too many parentheses were used for the 
CHOICES.  

Here is what I have now.  I hope this is helpful in getting this to work.
See below:

from django.db import models


class ContactOrOrganization(models.Model):
name = models.CharField(max_length=40)
organization = models.CharField(max_length=60, null=True, blank=True)
street_line1 = models.CharField("Street Line 1", max_length=50, 
null=True, blank=True)
street_line2 = models.CharField("Street Line 2", max_length=50, 
null=True, blank=True)
city = models.CharField(max_length=40, null=True, blank=True)
state = models.CharField(max_length=40, null=True, blank=True)
zipcode = models.CharField(max_length=20, blank=True, null=True)
phone1 = models.CharField(max_length=20, null=True, blank=True)
phone2 = models.CharField(max_length=20, null=True, blank=True)
email = models.EmailField(max_length=60, null=True, blank=True)
website = models.URLField(max_length=90, null=True, blank=True)
connections = models.ForeignKey('Connection', on_delete=models.CASCADE)


class Connection(models.Model):
CHOICES = (('following', 'Following'),
('family', 'Family'),
('friend', 'Friend'),
('clients', 'Clients'),
('recruiters', 'Recruiters'),
('acquaintances', 'Acquaintances'),
('employers', 'Employers'),
('Employment_Agencies', 'Employment Agencies'),
('unspecified', 'Unspecified'),
)
organization = models.ForeignKey("ContactOrOrganization", 
related_name="Contact_Organization", null=True, blank=True)
contact = models.ForeignKey("ContactOrOrganization", 
related_name="contact", null=True, blank=True)
connection_type = models.CharField(max_length=60, choices=CHOICES)

Thanks in advance for any help,
Bruce

-- 
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/eb67f110-3c66-4098-ad80-c5a7cbc85822%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with defining Models for ManyToMany and OneToMany relationships...

2016-05-02 Thread Bruce Whealton
As an update to this...  I decided to simplify things a bit.  For my 
contacts application, 
I decided to start with just one table.  I got that working in a 
Ubuntu Vbox 
environment, inside a virtualenv. 

I'm not sure if it is ok to use python manage.py makemigrations on the 
production server or if one should just do that locally and then import it.
Thanks for any advice,
This should be part of a larger posting on workflows moving from 
development to
production.
Thanks,
Bruce

On Saturday, April 23, 2016 at 10:30:45 AM UTC-4, Bruce Whealton wrote:
>
> Hello all,
>   So, I setup django in a virtualenv on my Ubuntu environment.  I 
> was reading the docs and thought I had things right 
> for creating the 3 models I wanted with this application. I am using 
> Postgresql.  I have the Postgresql driver for Python/Django installed
> in the virtualenv.  It is a "Contacts" app.  
> First question: Do django model fields default to required unless you use 
> blank=True, null=True?
> Many of my fields, I want to have optional.
>
> I have a class called Contact, a class called Organization and a class 
> called Connection.  
> I wanted to use the Organization as a foreign key on the Contact model.  I 
> could have more than one contact from
> an Organization.  The Connection model is inspired by the Google Plus idea 
> of "Circles" - e.g. friends,
> family, following, etc.   So, this would be a many-to-many relationship.  
>
> My problems are (1) I cannot create connections without specifying a 
> contact.  
> (2) If I was adding a contact using the admin interface, how do I allow no 
> value for that foreign field
> or allow for some kind of ajax type of text completion?  If a person is 
> family or friend, I may not need
> to list an Organization for them.
> (3) I would like to support multiple connection types - e.g. following, 
> employer, etc.
>
> So, here is my apps models.py file:
> >>>>
>
> from django.db import models
>
>
> class Contact(models.Model):
> name = models.CharField(max_length=40)
> Organization = models.CharField(max_length=50)
> street_line1 = models.CharField("Street Line 1", max_length=50)
> street_line2 = models.CharField("Street Line 2", max_length=50)
> city = models.CharField(max_length=40)
> state = models.CharField(max_length=40)
> zipcode = models.CharField(max_length=20, blank=True, null=True)
> phone1 = models.CharField(max_length=20)
> phone2 = models.CharField(max_length=20)
> email = models.EmailField(max_length=60)
>
>
> class Organization(models.Model):
> name = models.CharField(max_length=60)
> street_line1 = models.CharField("Street Line 1", max_length=50)
> street_line2 = models.CharField("Street Line 2", max_length=50)
> city = models.CharField(max_length=40)
> state = models.CharField(max_length=40)
> zipcode = models.CharField(max_length=20, blank=True, null=True,)
> phone = models.CharField(max_length=20)
> email = models.EmailField(max_length=60)
> website = models.URLField(max_length=90)
> contact_name = models.ForeignKey(Contact, on_delete=models.CASCADE)
>
>
> class Connection(models.Model):
> type = models.CharField(max_length=60)
> contact_name = models.ManyToManyField(Contact)   
>
> >>>
> Thanks in advance for any suggestions,
> Bruce 
>

-- 
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/8c7ad7e0-485b-4da1-81c0-8a63f0b108be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with defining Models for ManyToMany and OneToMany relationships...

2016-05-02 Thread Bruce Whealton
Michal,
   I had to read your response a few times but I finally got it.  I was 
reading
that all migrations are created in development only and then applied during 
production.  
So, during development you use makemigrations and then when deployed
you migrate.  

Thus, if you add a new feature, you make the migration on the 
development system then push it to producation, where you can
issue the command python manage.py migrate.  

I just thought of something that is related to migrations.  Suppose,
with my contacts app, I want to change the name field to be
first_name + last_name.  If there is data in the database, how will
this be handled?

I'll give it a try and see what happens.  It is just the development machine
that has the data.
Thanks,
Bruce

On Monday, May 2, 2016 at 11:48:52 AM UTC-4, Michal Petrucha wrote:
>
> On Mon, May 02, 2016 at 08:37:43AM -0700, Bruce Whealton wrote: 
> > I'm not sure if it is ok to use python manage.py makemigrations on the 
> > production server or if one should just do that locally and then import 
> it. 
>
> Hi Bruce, 
>
> Migrations are a part of your application's code base, and they should 
> be treated as such. In other words, you create all migrations during 
> development, and make sure to include them in your code repository, 
> and then as part of your deployment strategy, you only apply them in 
> the production environment. 
>
> Cheers, 
>
> Michal 
>

-- 
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/bd085f78-6126-4583-8570-1a3ee66778cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Help with moving a development project to production

2016-05-02 Thread Bruce Whealton
Hello all,
 I have been developing a django project and app on a Ubuntu 
system.  My production system is Centos 6 based ( I think, not Centos 7).  
First off, what should I commit to the repo?  I setup a virtualenv using 
virtualenvwrapper.  This included a bin directory, include directory and 
lib directory - 
do I need these in the repo?  Or should they be created on the production 
server using virtualenv?
 
What if the production environment didn't have a virtualenv?  I guess that 
is somewhat of a hypothetical question.  

If during development, I created various migrations and even added data to 
the database.  I am using Postgresql for both
development and production.  If I exported the database, with statements to 
create all the tables and then populate them with
data and then I import this to the database server used for production, 
does this create a problem?  I was told to commit
the migrations and then run/make them on the production server.  Is that 
only necessary if I did not export
everything and then import it all?  Or should I avoid importing the 
database with structure and data,
instead just running the migrations?

If I were moving from one server to another (both production servers ) I 
wouldn't want to lose my data.  It seems
like I would lose it all if I ran all the migrations.

Lastly, I heard that django likes to be in the top level folder for a 
domain - this was in a shared python hosting 
environment that had a one click installer from the control panel.  I also 
have access to a vps server with root shell access.  
It is Centos based with support for python and php.  How do I setup 
wsgi with apache?  Do I need to create a
vhost file?  In that case, I'd use a subdomain for one of my domains.
Thanks in advance for any help,
Bruce 


-- 
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/dba70b37-2ac3-42d9-8946-41754e1ce4e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Why don't I see my category ForeignKey field in related Model

2016-05-11 Thread Bruce Whealton
Hello all,
   I think that my problem here is Django specific and not 
necessarily a reflection on
my understanding of relational databases (hopefully).  
I did post about this previously and thought I had figured out what to do.  
I have a Django app that stores information on Contacts.  
With that one table things seemed to work fine.  When I wanted to categorize
the type of relationship - is this a professional relationship, family, 
friends, etc.
That's when things didn't show up like I wanted.  I finally got the 
migration to work
with the new table.  
I'm using python 3 with the latest version of django.  I have a 
mysql 
database.  I want a one to many relationship, where one contact can 
be characterized by many categories.  When I work with the django admin
and try to enter a contact, I'm not seeing a field for entering 
relationship categories.

So, here is my models.py for the contacts app.

from django.db import models


class Resource(models.Model):
first_name = models.CharField(max_length=40)
last_name = models.CharField(max_length=40)
organization = models.CharField(max_length=60, null=True, blank=True)
street_line1 = models.CharField("Street Line 1", max_length=50, 
null=True, blank=True)
street_line2 = models.CharField("Street Line 2", max_length=50, 
null=True, blank=True)
city = models.CharField(max_length=40, null=True, blank=True)
state = models.CharField(max_length=40, null=True, blank=True)
zipcode = models.CharField(max_length=20, blank=True, null=True)
phone1 = models.CharField(max_length=20, null=True, blank=True)
phone2 = models.CharField(max_length=20, null=True, blank=True)
email = models.EmailField(max_length=60, null=True, blank=True)
website = models.URLField(max_length=90, null=True, blank=True)

def __str__(self):
return "%s %s \t%s" % (self.first_name, self.last_name, 
self.organization)

class Meta:
ordering = ('last_name',)


class Relationship(models.Model):
category = models.CharField(max_length=120)
resource = models.ForeignKey(Resource, related_name='category')

def __str__(self):
return self.category

class Meta:
    ordering = ('category',)

Thanks in advance for any help,
Bruce

-- 
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/ab683e85-6945-4387-acd2-0ae3357db268%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why don't I see my category ForeignKey field in related Model

2016-05-13 Thread Bruce Whealton
You are absolutely right.  So, I just need to figure out how to change things 
in the models.py.  I'm not sure if django
needs a third model or not.
Thanks for helping where something should have been easier for me,
Bruce

-- 
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/1a4b5a83-8b2d-4e5f-8b7e-4b6bb6341f78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to implement a ManyToManyField with a View

2016-05-26 Thread Bruce Whealton
Hello all,
 I started a similar thread but couldn't find it.
I was creating a Personal Information Management Project, with Project name 
mypim.  My first app was a contacts app.
This has two Class based Models in the models.py in the contacts directory. 
 My first view works fine, where I display 
a list of contacts.  It seemed that the Django Admin got confused unless I 
put the Relationship model prior to the Resource model.
Ok, so, I call a Relationship model instead of Contact model for reasons 
unimportant to my question.  Here is what my models.py looks like
with some fields snipped to show only what is important.

class Relationship(models.Model):
category = models.CharField(max_length=60)

def __str__(self):
return self.category


class Resource(models.Model):
first_name = models.CharField(max_length=80)
last_name = models.CharField(max_length=80)
organization = models.CharField(max_length=100, null=True, blank=True)
[snip]
relationship = models.ManyToManyField(Relationship)

class Meta:
ordering = ['last_name',]

def __str__(self):
return self.first_name +  " " + self.last_name

And my views.py for the app:

def contact_list(request):
contacts = Resource.objects.all()
return render(request, 'contacts/contact_list.html', {'contacts': 
contacts })


def contact_detail(request, pk):
contact = get_object_or_404(Resource, pk=pk)
return render(request, 'contacts/contact_detail.html', {'contact': 
contact})

End of File.
Ok, so when I display the list of contacts/resources, things look fine and 
I can click on a contact and see
the details, aka full listing of the contact, minus the categories which 
come from the Resource.  I know things cannot be 
correct in that the view doesn't seem to query for the categories assigned 
to the Contact, aka Resource.  My contact_detail.html
template has this section for displaying the category in the Relationship 
model and I do have defined relationships.


  {% for relationship in contact.relationship_set.all %}
{{ relationship.category }}
  {% endfor %}


Can someone guide me here, please?  I'd actually like to display the 
categories separated by commas on the same line.  However, I am not seeing
anything in this area.

Thanks in advance for any help,
Bruce



-- 
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/39ddf178-8274-4323-acc1-8f9834da570d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Questions about Deploying django for production using apache and mod_wsgi.

2016-05-26 Thread Bruce Whealton
Hello all,
I have a few questions of which I am not finding answers.
1) If I export my development db (Postgresql) and then import it into 
production database,
won't I be pulling in a very weak password that I used for development?  I 
guess I can
just change that.
2) Should I export all the content and structure from my development server 
to my
production server?  Or should I just create the database connection and 
then run migrations and
then create the data content on the production server?  Obviously, my 
development server has
minimal content.

3) Should I just upload the other packages that I installed with pip on my 
development server or
should I instead run pip install on the production server to get all the 
packages needed on the
production server?  

4) Is it a best practice ( continuing from #3) to create a requirement file 
and use that to install
with pip all the packages, as opposed to uploading the packages from 
development to production?  
Note: I am developing on Ubuntu but deploying to Centos.  

5) I suppose, even if I had a Centos development environment, I would still 
want to install the required
packages on the production server instead of just uploading everything.

Regarding #5, I am liking Python better than what I have used for some 
time, PHP based application
development.  However, for the longest time, things were much simpler with 
php in that most php code is
just text and so there isn't the notion of "installing" a package.  One 
could expect things to work fine
if one just uploaded the site from development to production (perhaps 
certain new OO features are changing
this situation for php sites, e.g. the use of autoloaders but that's 
another topic).

6) Is there anything else, in addition to the top level assets (with 
js/css) that I would want apache to serve directly
versus going through mod_wsgi?  It seems like I read something to this 
effect relating to parts of the admin, 
that need to be served directly by apache.  I could be wrong.  

Thanks in advance for any help,
Bruce  

P.S. If anyone wants to develop a course on udemy.com on a python 
framework, please don't develop with
sqlite3 since we won't use that in production and please discuss deployment 
on a server besides 
something like pythonanywhere.com.  The issues of setting things up on 
one's own vps server are not 
trivial at all.  (smile).

-- 
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/50b71c19-10a1-4610-8050-191bde7facda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to implement a ManyToManyField with a View

2016-05-27 Thread Bruce Whealton
I have that in the contacts/views.py
However, I don't know if it needs the context dictionary to have something 
which would 
connect a contact to many categories.
Thanks,
Bruce

-- 
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/2edacaa2-b7ef-4f81-8666-3a126b5721df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Using PyMySQL as a MySQL driver

2016-11-09 Thread Craig Bruce
Hi,

I have to use MySQL and an associated driver. Looking through the options 
in the docs 
 
my choices are limited since a) I use Python 3 and b) I can't use GPL code. 
Unless Django importing a GPL library does not qualify as linking in the 
GPL sense. Previous threads from django-dev suggest that it probably does.

Therefore, I can't use any of the listed drivers. I came across PyMySQL 
, which does seem to just drop in and 
work as it is PEP 249 compliant and is MIT licensed.

My question is does anyone have experience using PyMySQL, are there any 
reasons why I shouldn't use it or known issues? Is anyone using it in 
production?

Thanks in advance for any advice.

Cheers
Craig

-- 
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/ba9a5446-e64c-4ada-b1b3-c582ab50fa9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django in Production and Virtualenv

2017-06-06 Thread Bruce Whealton
Hello all,
  There is a topic of confusion for me related to Apache and 
mod_wsgi.
I have been using two cloud providers DigitalOcean and PythonAnywhere.  The 
latter actually let me get
a home page being served by apache and not the development server ( which 
actually isn't even an option
on PythonAnywhere).  I could setup Django with one click and set it up with 
python3.4.  
  So, my questions are as follows: 1)  Virtualenv is described as 
so important but it seems it only can work in
development.  I mean once the terminal session closes, the venv that I 
setup is no longer active?
2) How do I get an IDE like Pycharm to recognize the Virtualenv?  I know I 
can select the compiler to be inside the 
Virtualenv but other libraries that I installed into that virtualenv, if 
the virtualenv is not active, then it won't find the 
installations of the different libraries.
3) I am thinking of using Docker to solve these problems but for some 
reason, I'd like to see how this was done without Docker.

4) I believe that nginx can work better as a reverse proxy whether using 
Docker or not, e.g. if I want to install WordPress 
on the same server or the same vps as Django/Flask, with nginx listening on 
port 80 the default.  I'm studying nginx now,
so, if apache can work as a reverse proxy, load balancer and web server, is 
it easier or better to use nginx for this?

Thanks so much for any help in advance,
Bruce   

-- 
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/0e9b0985-ae29-49cd-8005-1be393db79f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Isolated virtualenv and mod_wsgi - how do I do this on Apache

2018-06-28 Thread Bruce Whealton
Hello all,
   For a  long time, this has perplexed me and I cannot find the 
answer.  It is a crucial recommendation for deploying Django (or any Python 
app for that matter) into production.
Here is the issue.  I have two web hosting accounts, one is VPS with ssh 
root access.  The other is shared hosting that specifically targets users 
of Python-based applications such as Django.  
It appears that the shared Python environment does not allow ssh access.  
In all cases, a virtualenv is recommended for any Python 
deployment.  In both cases, I have Apache as the web server with mod_wsgi.  
Obviously, I need the server, Apache, to activate the 
Django environment.  I can ssh to my VPS but what good is that.  I don't 
need my username to be activating the Python isolated environment.  As soon 
as I close the ssh session the activated environment
is no longer activated.  My best guess is that the Apache user must 
activate the virtual environment and keep it activated as an isolated 
virtual environment.  
I have googled and googled for an answer to something so basic 
to deploying into production an isolated Python environment for Django (or 
any Python application) for that matter.  So, here is my best effort
to ask the question clearly.  How do I deploy into production a Django 
application following the best practice of using an isolated virtual 
environment that is activated even after I close my ssh session?

   Regarding the shared Python hosting, if I don't have ssh access 
I cannot even issue Pypi commands to install modules that I might need for 
my Django app.
Thanks,
Bruce

-- 
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/78f2b728-ae20-4daf-9d38-221f7487af05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.