Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
C
cp_video_dokku
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alexandr Dzehil
cp_video_dokku
Commits
5b58e6e9
Commit
5b58e6e9
authored
2 years ago
by
Ilya Simonov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix send video to s3
parent
de448400
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
9 additions
and
1 deletion
+9
-1
models.cpython-39.pyc
apps/core/__pycache__/models.cpython-39.pyc
+0
-0
s3_uploader.cpython-39.pyc
apps/core/__pycache__/s3_uploader.cpython-39.pyc
+0
-0
signals.cpython-39.pyc
apps/core/__pycache__/signals.cpython-39.pyc
+0
-0
utils.cpython-39.pyc
apps/core/__pycache__/utils.cpython-39.pyc
+0
-0
tasks.py
apps/core/tasks.py
+7
-1
settings.py
cp_video/settings.py
+2
-0
No files found.
apps/core/__pycache__/models.cpython-39.pyc
View file @
5b58e6e9
No preview for this file type
This diff is collapsed.
Click to expand it.
apps/core/__pycache__/s3_uploader.cpython-39.pyc
View file @
5b58e6e9
No preview for this file type
This diff is collapsed.
Click to expand it.
apps/core/__pycache__/signals.cpython-39.pyc
View file @
5b58e6e9
No preview for this file type
This diff is collapsed.
Click to expand it.
apps/core/__pycache__/utils.cpython-39.pyc
View file @
5b58e6e9
No preview for this file type
This diff is collapsed.
Click to expand it.
apps/core/tasks.py
View file @
5b58e6e9
import
os
import
requests
from
django.conf
import
settings
from
.models
import
Video
,
READY
from
.s3_uploader
import
upload_file
...
...
@@ -14,7 +17,10 @@ def send_video_to_s3():
for
local_video
in
local_videos
:
video_name
=
local_video
.
local_file
.
name
.
split
(
'/'
)[
-
1
]
key
=
asset_upload
(
local_video
,
video_name
)
content
=
local_video
.
local_file
.
read
()
file_path
=
settings
.
DOMAIN_NAME
+
settings
.
MEDIA_URL
+
key
response
=
requests
.
get
(
file_path
)
content
=
response
.
content
local_video
.
s3_file
=
upload_file
(
content
,
key
,
'video/mp4'
)
local_video
.
status
=
READY
...
...
This diff is collapsed.
Click to expand it.
cp_video/settings.py
View file @
5b58e6e9
...
...
@@ -166,3 +166,5 @@ else:
AWS_REGION_NAME
=
env
(
'AWS_REGION_NAME'
)
# CloudFront
AWS_S3_CUSTOM_DOMAIN
=
env
(
'AWS_S3_CUSTOM_DOMAIN'
)
DOMAIN_NAME
=
env
(
'DOMAIN_NAME'
,
default
=
'http://localhost:8000'
)
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment