media

django media not loading

人盡茶涼 提交于 2019-12-11 18:01:31
问题 So using django for the first time and ran into this issue where the media url does not want to load/work so far my urls.py is setup like so if settings.DEBUG: urlpatterns += patterns('', (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),) my settings.py like so PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media') MEDIA_URL = '/media/' ADMIN_MEDIA_PREFIX = 'http:/localhost:8000/admin-media/' my

python How to detect a new piece of media in the CD?

回眸只為那壹抹淺笑 提交于 2019-12-11 16:55:31
问题 I have a need to copy a group of files. Unfortunately these files will span multiple DVDs. What I want to do is a) copy the files of the current DVD b) when complete, eject the media and prompt the user to insert the next DVD c) Detect when media is inserted d) validate that is is the desired DVD (if not do B again) e) copy files f) repeat as needed Im fairly sure I know how to do all of this except for step C. How do I detect when a new CD has been inserted? 回答1: I ended up using a

Django - Media in production is not working

那年仲夏 提交于 2019-12-11 14:30:08
问题 My static files are working well, but my media ones have a problem. I already deployed my website in heroku and it is online in production. (DEBUG=False) Look at the code: settings.py BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) DEBUG = bool(os.environ.get('DJANGO_DEBUG', True)) STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static"), # '/var/www/static/' ] STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') MEDIA_ROOT = os.path.join(BASE_DIR,

Jersey Client resulting in 415 Unsupported media type

柔情痞子 提交于 2019-12-11 14:04:00
问题 The obvious reason for this would be not providing proper content type. But I am providing. Still i am getting Unsupported Media Type. Not sure why. Any help greatly appreciated. Client c = Client.create(); WebResource resource = c.resource(HOST+"/test"); Gson gson = new Gson(); Test test = new Test(); test.setTestName("TEST AUTOMATION"); resource.header("Content-Type", "Application/json"); String testStr = gson.toJson(test); System.out.println("Request Str: "+testStr); ClientResponse

Sitecore: GetMediaStream is always null

岁酱吖の 提交于 2019-12-11 12:18:27
问题 I have files stored in my master and web databases (Sitecore). I need to read the content of the a selected file. This is the code I use: MediaItem mediaItem = Sitecore.Context.Database.Items.GetItem(id); if (mediaItem != null) { Stream stream = mediaItem.GetMediaStream(); } stream is always null! I've tried this for several files. If I try to download the files, they do download successfully. I need to read the contents of the file. The mediaitem returns all the meta data (file name,

Media queries in iOS 7 not working

▼魔方 西西 提交于 2019-12-11 12:04:53
问题 I'm using a couple of media queries that target iPad and iPhone in landscape as well as portrait orientation, but as of iOS 7 they don't work anymore. They worked perfectly in iOS 6, though. Has anyone had a similar experience? Here's part of the code I'm using: <style type="text/css"> /* iPad (landscape) */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) { .header { font-family: courier new, monospace; color: #999999; font-size:

Android How to stop/kill/cancel Media Upload or Download

痞子三分冷 提交于 2019-12-11 11:33:54
问题 I create a AsyncTask to Upload or Download files on my Google Drive. This is an example of a part of my code to upload a file: public class AsyncUpload extends AsyncTask<String, String, String>{ Context c; public AsyncUpload(Context c) { super(); this.c = c; } @Override protected String doInBackground(String... params) { try{ // File's binary content java.io.File fileContent = new java.io.File(localFilePath); InputStreamContent mediaContent = new InputStreamContent(FileInfo.getMime

Use MediaScannerConnection scanFile To Scan Downloaded Image File

Deadly 提交于 2019-12-11 09:53:09
问题 I am working on an app in which I save image(s) to a directory but the Images wont show up in gallery until I restart the phone. Here's My Code Snippet public class SaveTask extends AsyncTask<String , String , String> { private Context context; private ProgressDialog pDialog; String image_url; URL myFileUrl; String myFileUrl1; Bitmap bmImg = null; File file ; public SaveTask(Context context) { this.context = context; } @Override protected void onPreExecute() { // TODO Auto-generated method

media queries not working in safari or chrome. working fine in firefox

廉价感情. 提交于 2019-12-11 08:34:39
问题 http://timenoplace.com/releases/ this is a site i am working on. media queries are working perfectly in firefox and not in safari or chrome. if you drop the width to below 960 - you will see the background turn yellow in firefox... but in safari and chrome, the changes do not register. i have never had this problem before. it is driving me insane. can't find anything online ... does anyone have any ideas ??? css validates... the project is a theme i built for wordpress. could that have

The URI given to MediaControl for a music file's album art .Net

你。 提交于 2019-12-11 08:16:47
问题 I want to show album art in the windows 8 media control, like this: However, MediaControl.AlbumArt has type Uri, instead of type ImageSource like I expected. Does the album art embedded in a music file even have a URI? I've tried providing a URI to the file ("file:///C:/Rest/Of/Path.mp3") (an immediate exception results), but other than that I don't even know where to start. Maybe I'm supposed to write the album art to a temporary file and point at that (feels like the wrong way to do it, but