Re: django, mod_wsgi, apache and sharing media files (video) from a separate directory

2014-04-20 Thread Ramón Carrillo
Hi Adam,

>From your settings.py I guess the expanded url is something like
/PROYECTOS/file.xyz, right?

But, in your Apache alias your are serving the url /proyectos/ [0],
and urls are case sensitive unless you're using mod_speling [1].

I think "Alias /PROYECTOS/ /PROYECTOS/" should do the trick.

[0] http://httpd.apache.org/docs/2.4/mod/mod_alias.html#alias
[1] http://httpd.apache.org/docs/2.4/mod/mod_speling.html

On Sun, Apr 20, 2014 at 9:19 AM, Adam Teale  wrote:
> Hi Guys,
>
>
> I am building a django app that runs out of my /Users/me/Dropbox directory.
>
>
> Localhost is pointed at my /Users/me/Sites directory.
>
>
> mod_wsgi installed.
>
> apache installed
>
> django installed and app working fine in development mode
>
>
> I am trying to embed media in a template
>
> This media comes from a directory outside of the django app - in the root of
> the machine - /PROYECTOS
>
>
> The permissions for the directories and preceding directories are readable
> by _www
>
>
> I think that I understand that
>
> - mod_wsgi will serve the dynamic files
>
> - apache will serve the static files like the css and template files, as
> well as the media files I am referencing in the /PROYECTOS directory
>
>
> I have the following in my settings.py:
>
> STATICFILES_DIRS = (os.path.join(BASE, "static"), )
>
> STATIC_URL = "/static/"
>
> MEDIA_URL = "/PROYECTOS/"
>
> WSGI_APPLICATION = 'mbrain.wsgi.application'
>
>
> In the /etc/apache2/extra/vhosts/localhost.conf I have:
>
>
> 
>
>
> DocumentRoot "/Users/me/Sites/localhost"
>
> ServerName localhost
>
>
> WSGIDaemonProcess localhost
> python-path=/Users/me/Dropbox/mBrain_Adam/mbrain/:/Users/me/Dropbox/mBrain_Adam/mbrain/venv/include/python2.7
>
> WSGIProcessGroup localhost
>
>
> Alias /proyectos/ /PROYECTOS/
>
>
> 
>
> Require all granted
>
> 
>
>
> WSGIScriptAlias / /Users/me/Dropbox/mBrain_Adam/mbrain/mbrain/wsgi.py
>
>
> 
>
> 
>
> Require all granted
>
> 
>
> 
>
>
> 
>
>
> So to embed a media file in a template I have this as the url:
>
> {{ MEDIA_URL }}{{ asset.assetPath }}
>
>
> When I load the page in a browser the console shows the fully expanded path
> for the media asset but with a 404 error - HTTP/1.1" 404 3045.
>
>
> I’d really appreciate any feedback on whether I am approaching this the
> right way or if I have completely missed the concept.
>
> Also any help on that 404 error would be appreciated.
>
>
> Cheers!
>
>
> Adam
>
> --
> 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/e6294564-01f1-449c-8cfb-e8dd474bda0b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

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


Re: POST URL questions

2014-04-20 Thread Ramón Carrillo
Hi,

POST variables are appended to the HTTP request body instead of the URL [0].

If you want a variable to be available in the request.POST dictionary,
the browser must send it as a POST variable (in the request body). You
could use a hidden input to do it:





[0] 
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/Sending_and_retrieving_form_data#The_method_attribute

On Sat, Apr 19, 2014 at 5:12 AM, nobody  wrote:
> Hi,
>
> I set up an URL when cliking a submit button, I got
> http://myhost.com/user/?userid=5987.
>
> In REQEST, I can get useid = request.GET['userid'], but in POST, I could not
> get the variable from the POST:
>
> if userid in request.POST
> userid = request.POST.get("userid", "")
>
> Despite the userid=5987 was included in the URL, the above check failed, how
> can I get variables in URL from POST? Also, not sure if the userid =
> request.POST.get("userid", "")
>  is the correct syntax to get variables from request.POST?
>
> Also, at the moment, I made a hard coded absolutely URL in the submit
> action:
>
> http://myhost.com/user/?userid={{
> request.user_id }}">{% csrf_token %}
>
> Is there a current URL I can put it in the action, for example, like action
> = "{{ current_url }}/?userid={{ request.user_id }}"?
>
> Thank you.
>
> Kind regards.
>
> --
> 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/6438db49-a616-48b0-ae16-dfaa51a2f70f%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

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


Re: URL variables failed to be found from POST

2014-04-20 Thread Russell Keith-Magee
On Sat, Apr 19, 2014 at 6:36 PM, nobody  wrote:

> Hi,
>
> I set up an URL when cliking a submit button, I got
> http://myhost.com/user/?userid=5987.
>
> If it is a REQEST, I can get useid = request.GET['userid']. But in POST, I
> could not get the variable from the POST, I could not even find the
> variable in POST, the following check userid in request.POST was false, and
> I cannot check if the syntax of next statement "userid =
> request.POST.get("userid", "")" is correct or not.
>
> if userid in request.POST
> userid = request.POST.get("userid", "")
>
>
>
> Also, at the moment, I made a hard coded absolutely URL in the submit
> action:
>
> http://myhost.com/user/?userid={{request.user_id 
> }}">{% csrf_token %}
>
> Is there a key word for current URL I can put it in the action, for
> example, like action = "{{ current_url }}/?userid={{ request.user_id }}"?
>

Hi,

request.GET contains the URL keywords, regardless of whether it's a GET or
POST request. In the case of a GET request, *all* the form data is
contained in request.GET if it's a GET request; if it's a POST request,
request.POST contains the form data, and request.GET contains the URL
arguments.

I hope that helps!

Yours,
Russ Magee %-)

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


Re: Django

2014-04-20 Thread Mark Phillips
It all depends on how you learn. You can read the API documentation and
gain a good understanding of what django provides as a framework. Or, read
the source and the comments to really understand what is going on. Reading
the source is a great use of your time.

Personally, I find it easier to learn the different aspects of a framework
by building something and running into situation of "how would I implement
functionality X", and then read the docs, forums, source and ask questions
to see how others solved this problem. One advantage is that you learn
**how** to find "django answers" to specific problems/issues as well as how
to use the framework. But everyone learns differently, so you need to do
what is best for your style of learning.

YMMV,

Mark


On Sat, Apr 19, 2014 at 10:53 PM, Srinivasulu Reddy <
srinivasulur5...@gmail.com> wrote:

> Hello mark,
>
>  I got suggestion what you all mention was great to me. I did
> poll application and have some basic view on django, but thing I have to
> mention here is there are so many module how learn all these in effective
> way. Like for example take 'django.templates' , it contain different fields
> and modules , functions like RequestContext ,loader . How do i learn these
> in useful way .
>
> On Saturday, April 19, 2014 11:37:38 AM UTC+5:30, Srinivasulu Reddy wrote:
>>
>>
>> Hello folks,
>>  I am new to python/django . i am earning myself i want
>> to know effective way of learning python / django . i am following django
>> book for django .  Light bird apps also.
>>
>> So please anyone can help me to find the good way learn the python /
>> django . I love to learn the python / django .
>>
>>  --
> 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/30190042-c97c-49c6-be07-399fc5e7c54c%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Exception Value: (502, 'Error: command "EHLO" not implemented')

2014-04-20 Thread rafiee.nima
Hi

Im using django send mail and here is my view code . 

def send(request):
send_mail('subject', 'message, 'mym...@gmail.com', 
['mym...@gmail.com'], fail_silently=False)

and I got thie error : 

Traceback:

  110. self.connection.sendmail(from_email, recipients, 
message.as_bytes())
File "/usr/lib/python2.7/smtplib.py" in sendmail
  710. self.ehlo_or_helo_if_needed()
File "/usr/lib/python2.7/smtplib.py" in ehlo_or_helo_if_needed
  537. raise SMTPHeloError(code, resp)

Exception Type: SMTPHeloError at /user/send/
Exception Value: (502, 'Error: command "EHLO" not implemented')

if anyboy can help :( 

-- 
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/6d67f44e-1f31-4c64-a5a4-0ca9a8516af1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django, mod_wsgi, apache and sharing media files (video) from a separate directory

2014-04-20 Thread Adam Teale


Hi Guys,


I am building a django app that runs out of my /Users/me/Dropbox directory.


Localhost is pointed at my /Users/me/Sites directory.


mod_wsgi installed.

apache installed

django installed and app working fine in development mode


I am trying to embed media in a template

This media comes from a directory outside of the django app - in the root 
of the machine - /PROYECTOS


The permissions for the directories and preceding directories are readable 
by _www


I think that I understand that

- mod_wsgi will serve the dynamic files

- apache will serve the static files like the css and template files, as 
well as the media files I am referencing in the /PROYECTOS directory


I have the following in my settings.py:

STATICFILES_DIRS = (os.path.join(BASE, "static"), )

STATIC_URL = "/static/"

MEDIA_URL = "/PROYECTOS/"

WSGI_APPLICATION = 'mbrain.wsgi.application'


In the /etc/apache2/extra/vhosts/localhost.conf I have:





 DocumentRoot "/Users/me/Sites/localhost"

ServerName localhost


 WSGIDaemonProcess localhost 
python-path=/Users/me/Dropbox/mBrain_Adam/mbrain/:/Users/me/Dropbox/mBrain_Adam/mbrain/venv/include/python2.7

WSGIProcessGroup localhost


 Alias /proyectos/ /PROYECTOS/


 

Require all granted




 WSGIScriptAlias / /Users/me/Dropbox/mBrain_Adam/mbrain/mbrain/wsgi.py


 



Require all granted









So to embed a media file in a template I have this as the url:

{{ MEDIA_URL }}{{ asset.assetPath }}


When I load the page in a browser the console shows the fully expanded path 
for the media asset but with a 404 error - HTTP/1.1" 404 3045.


I’d really appreciate any feedback on whether I am approaching this the 
right way or if I have completely missed the concept.

Also any help on that 404 error would be appreciated.


Cheers!


Adam

-- 
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/e6294564-01f1-449c-8cfb-e8dd474bda0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Please help me out, I tried to get sync for whole day @@

2014-04-20 Thread Gerald Klein
 'NAME': 'mysite'), the paran doesn't belong there


On Sat, Apr 19, 2014 at 10:11 AM, Toan ComS  wrote:

>
>
>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.sqlite3',
>> 'NAME': 'mysite'),
>> }
>> }
>>
>
> Is it wrong?
>
> --
> 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/fb92204d-f2a7-4e40-87b8-e85c13a9bbaf%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

geraldklein.wordpress.com

j...@zognet.com

708-599-0352


Arch Awesome, Ranger & Vim the coding triple threat.

Linux registered user #548580

Brought to you by the Amish Mafia

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