[07/Jan/2016 06:57:21] "GET /pi_app/video_entry/my-first-video-post/ HTTP/1.1" 200 678
Not Found: /media/video_entries/HALAYONG_BUNTOD_nExLhqF.mp4
[07/Jan/2016 06:57:21] "GET /media/video_entries/HALAYONG_BUNTOD_nExLhqF.mp4 HTTP/1.1" 404 2157
....
....
INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'pi_app',)
MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware',
TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS':[os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.contrib.messages.context_processors.messages', ], }, },]
STATIC_URL = '/static/'
STATIC_PATH = (os.path.join(BASE_DIR, 'static'), '/var/www/static/',)
STATICFILES_DIRS = ( STATIC_PATH,)MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')from django.conf.urls import urlfrom django.conf import settingsfrom django.conf.urls.static import static
from . import views
urlpatterns = [ url(r'^$', views.UserMainView.as_view(), name='index'), url(r'^upload_file/$', views.upload_file, name='upload_file'), url(r'^video_entry/(?P<video_slug>[\w-]+)/$', views.video_entry, name='video_entry'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)class Entry(models.Model): VIDEO_ENTRY_TYPE = ( ('TALK/PRESENTATION', 'Talk/Presentation'), ('LECTURE', 'Lecture'), ....
.... ) user = models.ForeignKey(User) video = models.FileField(upload_to='video_entries')
entry_type = models.CharField(max_length=100, choices=VIDEO_ENTRY_TYPE) title = models.CharField(max_length=150)
slug = models.SlugField(unique=True)
....
....def video_entry( request, video_slug): video_details = Entry.objects.get(slug = video_slug) context = {'video_details': video_details} context['presentation_video']= video_details.video context['presentation_title'] = video_details.title
....
....
return render(request, 'pi_app/video_page.html', context){% block presentation_video %} <video width="600" height="540" controls> <source src="{{ MEDIA_URL }}{{ presentation_video }}" type="video/mp4"> </video> <p>Title : {{ presentation_title }}</p> ... ... {% endblock %}--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b2de9c50-0f76-4c3f-bc61-36f027495a37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.