Re: Question about subdomains.

2015-02-11 Thread Bruno Barcarol Guimarães
It depends if there is a need to separate the code from the sites on three
projects. If the code is not so complex and you can fit them all on a single
project, you can just configure the web servers to serve the same project on
the three domains.

On Tuesday, February 10, 2015 at 3:22:29 PM UTC, Chen Xu wrote:
>
> Hi
> I am using Django to build a website.
>
> I saw some websites have www.ABC.com, support.ABC.com, and career.ABC.com. 
> I wonder how this is achieved. Are these 3 different apps in 1 project, or 
> 3 different projects.
>
> Thanks
>
>
>
> -- 
> ⚡ Chen Xu ⚡
>  

-- 
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/d70603bf-f4ef-4883-b9a6-d905b4c50bf6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Query Set

2015-02-11 Thread Ajay M
I'm on a Django Project, I'm stuck with this situation. I've 3 Models, 
records,users and towns. Records are posted by users who belongs to towns. 
User may be a mobile user or a web user. Primary key of users is a foreign 
key in records, primary key of towns is a foreign key in users. I need to 
find the total number of posts made by web users and mobile users, who 
belongs to the top 5 towns by numbers of records. Can any one help me to 
find that?

-- 
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/af678d86-d0c0-499b-ad66-e73db9479f1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Query Set

2015-02-11 Thread C. Kirby
I'm sure someone can help you, but you need to post some more information 
to get useful support. Please post the models that you are dealing with, as 
well as maybe an example of the result you are trying to get. 

On Wednesday, February 11, 2015 at 8:20:59 AM UTC-6, Ajay M wrote:
>
> I'm on a Django Project, I'm stuck with this situation. I've 3 Models, 
> records,users and towns. Records are posted by users who belongs to towns. 
> User may be a mobile user or a web user. Primary key of users is a foreign 
> key in records, primary key of towns is a foreign key in users. I need to 
> find the total number of posts made by web users and mobile users, who 
> belongs to the top 5 towns by numbers of records. Can any one help me to 
> find that?
>

-- 
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/767eeeac-5395-4bcc-b5c2-0d32fc61b331%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Any Django developers in Chicago?

2015-02-11 Thread Brian Ray
Hey all,

We are having a Django focused meetup with ChiPy (Chicago Python User 
Group) tomorrow night:

RSVP

http://chipy.org and/or http://www.meetup.com/_ChiPy_/events/220117890/


Talks will be recorded. Also looking for more talks.


Hope to see some of you there.

Warm Regards, Brian Ray

-- 
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/c81a7151-8e73-41ab-80ee-f2e5535433ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Testing posts to S3

2015-02-11 Thread Lee Hinde
I'm using django storages/boto to push json files to s3 where they are to
be read by a different app.

I'd like to test the file push by using the Test Client to see if the file
is present on S3.

client = Client()
r = client.get(url, content_type="application/json")

In every case, r comes back as:



I can take the  'url' and paste it into my browser and get the file.

So, there's something about the process I'm not understanding. Is this not
what Client is intended for?

-- 
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/CA%2BePoMw-gi%2BMMKXRAVA6XbpSXGmCP38rc2c-c2%3DJQ%3D6bOcPc3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question about subdomains.

2015-02-11 Thread Tom Evans
On Tue, Feb 10, 2015 at 3:22 PM, Chen Xu  wrote:
> Hi
> I am using Django to build a website.
>
> I saw some websites have www.ABC.com, support.ABC.com, and career.ABC.com. I
> wonder how this is achieved. Are these 3 different apps in 1 project, or 3
> different projects.
>
> Thanks

Technically:

Each name resolves to an IP address. Many names can resolve to one IP.
The browser contacts that IP address and requests a page, including
the server name entered, eg 'career.abc.com'.
The web server decides how to handle that request.
A web server can be configured to respond to requests for different
names in different ways.
It can serve a completely different website for each name, running a
separate web application for each one, each with a different document
root.
Alternatively, it can send all requests to the same web application,
or some mixture of the two.

Django is not a web server, but can be used with all common web
servers to achieve any of the scenarios above. You can run several
distinct and different web applications, one for each name, or one
application could service many names. It's more common to serve many
sites from one django app if all the sites are versions of the same
thing, for instance, forum1.abc.com and forum2.abc.com.

Cheers

Tom

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


Re: Testing posts to S3

2015-02-11 Thread Tom Evans
On Wed, Feb 11, 2015 at 7:36 PM, Lee Hinde  wrote:
> I'm using django storages/boto to push json files to s3 where they are to be
> read by a different app.
>
> I'd like to test the file push by using the Test Client to see if the file
> is present on S3.
>
> client = Client()
> r = client.get(url, content_type="application/json")
>
> In every case, r comes back as:
>
> 
>
> I can take the  'url' and paste it into my browser and get the file.
>
> So, there's something about the process I'm not understanding. Is this not
> what Client is intended for?

No, the test client isn't a client for making web requests, it is a
client that creates phony request objects and simulates the
request/response inside of django itself. No network activity will
take place!

Just open it:

try:
r = urllib.urlopen(url).read()
except IOError:
...

Cheers

Tom

-- 
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/CAFHbX1%2BZPVagLTGP9t%3Dpk%2B%3Di7%2BssSu%3DL5T9UO2Y8kEhPwVUkgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tests and read-only database

2015-02-11 Thread Tom Evans
On Tue, Feb 10, 2015 at 1:29 AM, Scot Hacker  wrote:
> My project access two databases, one of which is remote and read-only. When
> running tests, Django wants to create a test_ copy of that db on the remote
> host, but of course it lacks permission (I lack write access to the entire
> db host). So I'm blocked from running *any* tests, even ones that don't
> involve models for the remote data.
>
> I've come up with four possible solutions:
>
> 1) Tell Django's test runner to create the test version of that db locally,
> not on the remote host. However, the documentation doesn't indicate a way to
> use the TEST: {} dictionary to specify an alternate host. This would be my
> preferred approach, but it doesn't seem possible.
>
> 2) Use this module, which tells the test runner to treat the read-only db
> "as-is" rather than creating a copy of it. I don't like this because of the
> risk that the db might one day NOT be read-only (it's been discussed in our
> org). And  the module is 3 years old without updates.
>
> 3) Use this technique, where the read-only db is pop()'d off the settings,
> making Django effectively forget it exists during testing (but then of
> course I can't test any code that involves those models). I'm currently
> doing this just to get tests back on the rails, but it's obviously very
> limiting.
>
> 4) Use this technique, which alters the routers configuration during
> testing.
>
> Is there a preferred or recommended approach to this problem?
>
> Thanks.
>

5) Use a different settings module for running tests

python manage.py test --settings=project.settings.tests

Having separate configuration files for test allows you to have more
easily repeatable tests, very useful with multi person teams.

We use a structure like so:

manage.py
an_app/
project/
└── settings
├── ci.py
├── defaults.py
├── devs
│   ├── dick.py
│   ├── harry.py
│   └── tom.py
└── www.py


Anyone can then run "python manage.py jenkins
--settings=project.settings.ci" to see exactly what CI (in our case
jenkins) will think of their pending commit. It also makes it
considerably easier in development to override things, eg in my
settings file I might have:

from ..defaults import *
DEBUG = True
INSTALLED_APPS = list(INSTALLED_APPS) + [ 'debug_toolbar', ]


Depending on how your settings are structured currently, you might
need to move some things around and possibly update your manage.py and
wsgi.py to indicate a new default settings module.

Cheers

Tom

-- 
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/CAFHbX1%2BASL0Y43J6aQpCWrm5B6rPPiKwiDkT1ryq8u2%3DepMbNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question about subdomains.

2015-02-11 Thread Sergiy Khohlov
Also one project can serve few domain names.
10 лют. 2015 17:22, користувач "Chen Xu"  написав:

> Hi
> I am using Django to build a website.
>
> I saw some websites have www.ABC.com, support.ABC.com, and career.ABC.com.
> I wonder how this is achieved. Are these 3 different apps in 1 project, or
> 3 different projects.
>
> Thanks
>
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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/CACac-qbEVzrX4W-A2jFMoi5ogTFeptj65kLyH3_UkOQ%3Dw%2BvAWw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Edx LDAP Auth setting

2015-02-11 Thread 'Yip Terence' via Django users
Hi L,
 
Actually, I has been input the LDAP string in 
/edx/app/edxapp/edx-platform/lms/envs/common.py.  But there a two 
problems after the configuration. Firstly, the script can't get the 
%user value I need to hardcode the username / email in the connection 
string than I can login to edx.  Secondly, can't to create an user profile 
when first login.
 
Is it need to modify the views.py and urls.py file for collect the %user 
value and create the user profile?
 
 
I have 2 version django in edx.
./edx/app/edxapp/venvs/edxapp/src/lettuce/tests/integration/lib/Django-1.3/django/bin/django-admin.py
./edx/app/edxapp/venvs/edxapp/src/lettuce/tests/integration/lib/Django-1.2.5/django/bin/django-admin.py
 
 
ldap_auth_ldap:
How can I find the version?  I using the apt-get to install the package.
 
The search settings.py result.
---Setttings.py---
./edx/app/xqueue/xqueue/xqueue/settings.py
./edx/app/xqueue/venvs/xqueue/lib/python2.7/site-packages/django/conf/project_template/project_name/settings.py
./edx/app/xqueue/venvs/xqueue/lib/python2.7/site-packages/newrelic-2.18.1.15/newrelic/api/settings.py
./edx/app/edxapp/edx-platform/common/test/acceptance/pages/studio/settings.py
./edx/app/edxapp/edx-platform/lms/djangoapps/django_comment_client/settings.py
./edx/app/edxapp/edx-platform/lms/lib/comment_client/settings.py
./edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages/django_countries/tests/settings.py
./edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages/method_override/settings.py
./edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages/example/settings.py
./edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages/django/conf/project_template/project_name/settings.py
./edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages/dealer/contrib/django/settings.py
./edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages/newrelic-2.18.1.15/newrelic/api/settings.py
./edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages/django_extensions/settings.py
./edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages/appconf/tests/settings.py
./edx/app/edxapp/venvs/edxapp/src/django-pipeline/pipeline/conf/settings.py
./edx/app/edxapp/venvs/edxapp/src/django-pipeline/tests/settings.py
./edx/app/edxapp/venvs/edxapp/src/edx-val/edxval/settings.py
./edx/app/edxapp/venvs/edxapp/src/lettuce/tests/integration/lib/Django-1.3/django/conf/project_template/settings.py
./edx/app/edxapp/venvs/edxapp/src/lettuce/tests/integration/lib/Django-1.2.5/django/conf/project_template/settings.py
./usr/local/lib/python2.7/dist-packages/django/conf/project_template/project_name/settings.py
 
Thank you very much for your assistance.
 
Thanks and Regards,
Terence Yip

Yip Terence於 2015年2月10日星期二 UTC+8下午12時00分30秒寫道:

> Dear All,
>
> I have been installed the open edx and django_auth_ldap package (
> http://code.edx.org/) in our environment.  However, I'm not successful to 
> config the Auth with LDAP.  Could anyone could provide the guide to me?  I 
> don't know where is the settings.py file path in open edx.
>
> Please help.
>
> Thanks and Regards,
> Terence Yip
>

-- 
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/1609da7e-6fec-43f9-bf0d-89761a4c97a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.