Re: is it possible to use REST API with HTML within Django?

2013-08-15 Thread evh
I am not too concerned about anything being returned (JSON or otherwise), 
it is just getting the command to the device.  So for example, I have a DVR 
connected to my webserver, the following is the REST API call:


def play(self):
"""
Convenience method to start playback.
"""
self.sendTransportCommandByDescription("Play Command")


which should simply start the DVR playback.


On Thursday, August 15, 2013 12:45:01 PM UTC-4, BFSchott wrote:
>
> You need to provide a lot more information before anyone can help.  
>
> Sound like you have at least a view handling GET or POST returning JSON?
>
> https://docs.djangoproject.com/en/1.5/topics/class-based-views/mixins/#jsonresponsemixin-example
> http://django-rest-framework.org
>
> If you are talking about calling AJAX from inside the browser, I recommend 
> you check out:
> http://www.dajaxproject.com
>
> There are other tools, but it makes life easier.
>
> Brian Schott
> bfsc...@gmail.com 
>
>
>  
> On Aug 15, 2013, at 12:27 PM, evh > wrote:
>
> Hi,
>
> I am having trouble getting REST to work within Django.  Has anyone 
> succeeded in doing this?  How do I embed REST API calls within the HTML 
> that runs my webpage?  I am trying to send "commands" to a device that is 
> connected to my webpage and can do this outside of Django manually in a 
> PowerShell window, but just within my HTML code.
>
> Thanks for any help or advice,
> Ed
>
>
> -- 
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


is it possible to use REST API with HTML within Django?

2013-08-15 Thread evh
Hi,

I am having trouble getting REST to work within Django.  Has anyone 
succeeded in doing this?  How do I embed REST API calls within the HTML 
that runs my webpage?  I am trying to send "commands" to a device that is 
connected to my webpage and can do this outside of Django manually in a 
PowerShell window, but just within my HTML code.

Thanks for any help or advice,
Ed

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: new user having trouble displaying images stored on local disk drive

2013-07-17 Thread evh
Thanks, but my real problem turned out to be a missing comma after the 
staticfiles_dirs entry.  After adding it I was able to see files stored on 
my hard drive.


On Wednesday, July 17, 2013 2:07:42 AM UTC-4, Lukáš Němec wrote:
>
> Hi, 
>
> You are not the first to have trouble when serving images from django's 
> built-in server. 
> It is not only images, but all staticfiles. 
>
> I'd like to clarify your settings.py 
>
> The directory you have put in STATICFILES_DIRS will be available to 
> django as /static/ in your web app, but you need to have 
>
> STATICFILES_FINDERS = 
>
> ("django.contrib.staticfiles.finders.FileSystemFinder", 
>   "django.contrib.staticfiles.finders.AppDirectoriesFinder") 
>
>
> Also the django test server needs to have correct permissions to open 
> and read that folder, 
> but when you go just to /static/, you will not see anything, it will not 
> list the files, you need to specify exact name of the file. 
>
> Django help: 
> https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/ 
>
> If this didn't help, try stackowerflow 
>
> Lukas 
>
>
> On 07/16/2013 07:09 PM, evh wrote: 
> > Working in a Windows environment without a production server - 
> > everything on one machine for ease of development (or so I thought). 
> >  Can display images pulled from the web, but not any stored on local 
> > hard drive.  Some of the relevant items in my settings.py looks like 
> > this: 
> > MEDIA_ROOT = 'C:/djcode/images/' 
> > MEDIA_URL = 'C:/djcode/images/' 
> > STATIC_ROOT = '' 
> > STATIC_URL = '/static/' 
> > STATICFILES_DIRS = ( 
> > # Put strings here, like "/home/html/static" or 
> > "C:/www/django/static". 
> > # Always use forward slashes, even on Windows. 
> > # Don't forget to use absolute paths, not relative paths. 
> > "C:/djcode/images/" 
> > ) 
> > Would appreciate any guidance or suggestions on what I am missing or 
> > doing incorrectly.  Thanks. 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to django-users...@googlegroups.com . 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > Visit this group at http://groups.google.com/group/django-users. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




trouble displaying images stored on disk drive

2013-07-16 Thread evh
Hello, I am having trouble displaying images stored on my local disk drive. 
 Displaying images pulled from the web work fine, it is only the local ones 
that are not showing up.  I am developing in a Windows environment and am 
not using a production server yet - everything is on a single computer for 
now (as I thought that would make things easier as I am new to Python and 
Django).  I am sure it is a simple configuration problem I am having, but I 
have not been able to track it down yet.  I have the following in my 
settings.py file:
MEDIA_ROOT = 'C:/djcode/images/'
MEDIA_URL = 'C:/djcode/images/'
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"C:/djcode/images/"
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
Thanks for any advice or help in tracking down what my problem might be.

evh

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




new user having trouble displaying images stored on local disk drive

2013-07-16 Thread evh
Working in a Windows environment without a production server - everything 
on one machine for ease of development (or so I thought).  Can display 
images pulled from the web, but not any stored on local hard drive.  Some 
of the relevant items in my settings.py looks like this:
MEDIA_ROOT = 'C:/djcode/images/'
MEDIA_URL = 'C:/djcode/images/'
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"C:/djcode/images/"
)
Would appreciate any guidance or suggestions on what I am missing or doing 
incorrectly.  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.
For more options, visit https://groups.google.com/groups/opt_out.