Skip to content
This repository was archived by the owner on Jan 25, 2020. It is now read-only.
Open

Dev #48

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
250 commits
Select commit Hold shift + click to select a range
fdd2287
Basic structure of flask-app
AndreyAnokhin Aug 17, 2019
ccf2e86
Create requirements.txt and add flask to it.
AndreyAnokhin Aug 17, 2019
c23b4b2
how to run
AndreyAnokhin Aug 17, 2019
b0866e7
Update config.py
Mo1far Aug 17, 2019
8ef6557
Merge pull request #14 from sphericalpm/flask_app
xzwache Aug 17, 2019
94533bb
added idea settings into gitignore
Aug 17, 2019
ffad299
add flask-wtf in requirements
AlexeyRadchenko Aug 17, 2019
fc50c9d
create podcast upload form class
AlexeyRadchenko Aug 17, 2019
402b696
add custom error pages
AndreyAnokhin Aug 17, 2019
a654885
created models and database settings
Aug 17, 2019
f418835
add upload route
AlexeyRadchenko Aug 17, 2019
4462f5e
added *.mp3
Kvm99 Aug 17, 2019
2848c9b
gTTS speech synthesis version added
Kvm99 Aug 17, 2019
a2a62bb
fix config get
Aug 17, 2019
a2011fd
change block app_content to content
AndreyAnokhin Aug 17, 2019
f33375a
added base template
Mo1far Aug 17, 2019
24a9ae5
Edited file methods
Aug 17, 2019
3d802e7
Merge pull request #18 from sphericalpm/DB
Aug 17, 2019
3ee0ece
added yandex_tokens.py
Kvm99 Aug 17, 2019
b84ceda
yandex speech synthesis start of work
Kvm99 Aug 17, 2019
3004a53
Merge pull request #17 from sphericalpm/error_pages
AndreyAnokhin Aug 17, 2019
5300833
Merged dev fixed conflict
Kvm99 Aug 17, 2019
e58e22a
Merge branch 'dev' of https://github.com/sphericalpm/Eriwan into feat…
Kvm99 Aug 17, 2019
ac265ee
added logging
Kvm99 Aug 17, 2019
df4c6ab
Update main.html
Mo1far Aug 17, 2019
6f2ac42
Merge pull request #20 from sphericalpm/feature/create_main.html
CHuKeR Aug 17, 2019
1616ed0
create form template and form validation
AlexeyRadchenko Aug 17, 2019
df1e3ec
rename main.html to base.html
AndreyAnokhin Aug 17, 2019
f9d5514
Now, right renaming
AndreyAnokhin Aug 17, 2019
9903892
merged dev fixed conflict in index.html
AlexeyRadchenko Aug 17, 2019
935cace
merged dev fixed conflict in routes.py
AlexeyRadchenko Aug 17, 2019
d53133a
Add db.session.rollback in case of 500 error
AndreyAnokhin Aug 17, 2019
3b760ee
merged dev fixed conflict in requirements.txt
AlexeyRadchenko Aug 17, 2019
e200d8b
Merge branch 'dev' into upload-file-and-template
AlexeyRadchenko Aug 17, 2019
ec18cf3
add file size limit and upload folder in app config
AlexeyRadchenko Aug 17, 2019
3821c1e
add user login/logout function
Mo1far Aug 17, 2019
c861af1
add user login/logout function
Mo1far Aug 17, 2019
b460a48
Merge branch 'dev' of https://github.com/sphericalpm/Eriwan into User…
Mo1far Aug 17, 2019
8a68b57
changed module name
Kvm99 Aug 17, 2019
bb3f6fa
requirements.txt updated
Kvm99 Aug 17, 2019
28faf3b
changed name to snake_case
Kvm99 Aug 17, 2019
e125718
tests start edition
Kvm99 Aug 17, 2019
a93cce0
Update __init__.py
Mo1far Aug 17, 2019
bc68c2a
io.bytes (file in memory) in process
Kvm99 Aug 17, 2019
8cfbfdd
Update .gitignore
Mo1far Aug 17, 2019
972b2b6
Update forms.py
Mo1far Aug 17, 2019
e3bd8ae
Update routes.py
Mo1far Aug 17, 2019
ed1a20b
audio merge
dschglv Aug 17, 2019
a4cde3f
Merged requirement fixed conflict.
Kvm99 Aug 17, 2019
b574a57
added base template
Mo1far Aug 17, 2019
f462933
Update main.html
Mo1far Aug 17, 2019
06214a7
rename main.html to base.html
AndreyAnokhin Aug 17, 2019
fe468c7
Now, right renaming
AndreyAnokhin Aug 17, 2019
4563152
Add db.session.rollback in case of 500 error
AndreyAnokhin Aug 17, 2019
8a0183d
add user login/logout function
Mo1far Aug 17, 2019
0126943
add user login/logout function
Mo1far Aug 17, 2019
758fd54
Update __init__.py
Mo1far Aug 17, 2019
8528bea
add user login/logout function fix
Mo1far Aug 17, 2019
dd51614
Update .gitignore
Mo1far Aug 17, 2019
ed43f83
Update forms.py
Mo1far Aug 17, 2019
4ac1e60
add user login/logout function fix
Mo1far Aug 17, 2019
f5f8a94
Removed folder from repository
Mo1far Aug 17, 2019
bda2ac2
added speech synthesis
Kvm99 Aug 17, 2019
2104dbc
removed to app/utils.py
Kvm99 Aug 17, 2019
8fd40db
text version. deleted
Kvm99 Aug 17, 2019
e3a15c9
Merge branch 'User_authorization+template' of https://github.com/sphe…
Mo1far Aug 17, 2019
7640fcc
add episode object create when file upload
AlexeyRadchenko Aug 17, 2019
582b60f
renamed to audio_merge_and_text_to_speech.py
Kvm99 Aug 17, 2019
1e42a7c
added TODO
Kvm99 Aug 17, 2019
0116e78
add base template with init flask-bootstrap
Aug 17, 2019
79f112c
add:
Aug 17, 2019
bc8b856
add login_ required
AlexeyRadchenko Aug 17, 2019
22c797c
Remove files
Mo1far Aug 17, 2019
7ae0f04
Merge pull request #22 from sphericalpm/feature/audio-merge
AndreyAnokhin Aug 17, 2019
82d34e6
Merge pull request #25 from sphericalpm/add_joke
AndreyAnokhin Aug 17, 2019
8a36126
pep8 fix
Aug 17, 2019
d9bef00
Merge pull request #24 from sphericalpm/base_template
CHuKeR Aug 17, 2019
93c77c8
Update __init__.py
CHuKeR Aug 17, 2019
be14646
Merge branch 'dev' into User_authorization+template
CHuKeR Aug 17, 2019
8303028
Merge pull request #21 from sphericalpm/User_authorization+template
CHuKeR Aug 17, 2019
29fca5a
improve error templates
AndreyAnokhin Aug 17, 2019
847d37a
Merge branch 'dev' of https://github.com/sphericalpm/Eriwan into dev
AndreyAnokhin Aug 17, 2019
92bd784
corrent IndentationError
AndreyAnokhin Aug 17, 2019
fdf6aa6
Merge pull request #26 from sphericalpm/feature/Registration
CHuKeR Aug 17, 2019
b45341c
syntax fix
Mo1far Aug 17, 2019
bfbe767
authorization fix
Mo1far Aug 17, 2019
23dc1d1
os.path.join instead of str formats & removed generate_wrapped_file m…
dschglv Aug 17, 2019
299e3a3
Registration with template
xzwache Aug 17, 2019
6fc64de
pep 8
xzwache Aug 17, 2019
8fe2f1a
Merge branch 'dev' into feature/Registration
CHuKeR Aug 17, 2019
241b4b3
fix merge conflict index.html
AlexeyRadchenko Aug 18, 2019
ece1343
fix merge conflict app/routes.py
AlexeyRadchenko Aug 18, 2019
d630c66
fix merge conflict app/forms.py
AlexeyRadchenko Aug 18, 2019
09e658e
add drop-zone.js for episode upload
AlexeyRadchenko Aug 18, 2019
6eeb10c
dev branch changes
Kvm99 Aug 18, 2019
ea5b654
merged conflict
Kvm99 Aug 18, 2019
71e7b76
correct conflict merge
Kvm99 Aug 18, 2019
418a44c
correct conflict merge
Kvm99 Aug 18, 2019
fadb3ff
add admin_required decorators
Mo1far Aug 18, 2019
e31e020
update requirements
AndreyAnokhin Aug 18, 2019
cfb3913
Merge branch 'feature/speech_synthesis' of https://github.com/spheric…
Kvm99 Aug 18, 2019
c16f7fe
Merge pull request #29 from sphericalpm/User_authorization+template
AndreyAnokhin Aug 18, 2019
23c3f60
Merge branch 'dev' of https://github.com/sphericalpm/Eriwan into dev
AndreyAnokhin Aug 18, 2019
29bf482
Fix login template
AndreyAnokhin Aug 18, 2019
368f73e
added flask login, flask-bootstrap, flask-wtf
Kvm99 Aug 18, 2019
11bbb40
test file for start check audio utils
Kvm99 Aug 18, 2019
f5533b7
changes save file to temp in text_to_speech, to folder in concatenate…
Kvm99 Aug 18, 2019
36a2991
static removed to Eriwan folder
Kvm99 Aug 18, 2019
2dd6a7e
static in the project root
Kvm99 Aug 18, 2019
2b997ec
changed doc strings
Kvm99 Aug 18, 2019
4e9019c
Merge branch 'dev' into features/admin_required_decorator
CHuKeR Aug 18, 2019
3ce96be
Merge pull request #30 from sphericalpm/features/admin_required_decor…
CHuKeR Aug 18, 2019
19aec64
added MEDIA_ROOT
Kvm99 Aug 18, 2019
611f774
changed from STATIC_ROOT to MEDIA_ROOT
Kvm99 Aug 18, 2019
968537e
static to app folder
Kvm99 Aug 18, 2019
c59f87f
use media dir instead of static
dschglv Aug 18, 2019
3c524f2
Merge remote-tracking branch 'origin/feature/speech_synthesis' into f…
dschglv Aug 18, 2019
a99df1c
changed path
Kvm99 Aug 18, 2019
a6b8daa
style changes
Kvm99 Aug 18, 2019
a69d9c6
empty file
Kvm99 Aug 18, 2019
a65a415
accept Dayana's change
Kvm99 Aug 18, 2019
62d11f2
Add route for user_profile
AndreyAnokhin Aug 18, 2019
5e85f43
change generate_base_file method in Joke
dschglv Aug 18, 2019
1a996f2
add admin_required decorators
Mo1far Aug 18, 2019
8f39a04
fix dromzone csrf errror
AlexeyRadchenko Aug 18, 2019
6063b38
Merge branch 'features/user_profile' of https://github.com/sphericalp…
Mo1far Aug 18, 2019
9668ecf
change STATIC_ROOT to MEDIA_ROOT in get_file_path metod in Joke, Episode
dschglv Aug 18, 2019
11caf90
Custom RssPodcast was added
Aug 18, 2019
bc28604
fix req file
Aug 18, 2019
3fbc550
Merge branch 'features/user_profile' of https://github.com/sphericalp…
Mo1far Aug 18, 2019
f7501df
minor fix models
Aug 18, 2019
9a37800
Delete style, because we use flask-bootstrap
AndreyAnokhin Aug 18, 2019
3009980
Merge branch 'features/user_profile' of https://github.com/sphericalp…
Mo1far Aug 18, 2019
43fb584
Merge branch 'features/user_profile' of https://github.com/sphericalp…
AndreyAnokhin Aug 18, 2019
1210833
Merge branch 'features/user_profile' of https://github.com/sphericalp…
Mo1far Aug 18, 2019
b8014d3
removed app dependencies from audio_utils & models changes
dschglv Aug 18, 2019
d62d4fd
just start of doing tests
Kvm99 Aug 18, 2019
954c965
deleted unnecessary
Kvm99 Aug 18, 2019
8635a54
Merge branch 'feature/speech_synthesis' of https://github.com/spheric…
Kvm99 Aug 18, 2019
554915f
Merge branch 'features/user_profile' of https://github.com/sphericalp…
Mo1far Aug 18, 2019
a2e982c
flake8 fixes
dschglv Aug 18, 2019
5a14839
add comments
Aug 18, 2019
dab8c14
Change base template to support boostrap4
AndreyAnokhin Aug 18, 2019
da36fdd
Add login_required to profile route
AndreyAnokhin Aug 18, 2019
6605bf0
Merge branch 'features/user_profile' of https://github.com/sphericalp…
AndreyAnokhin Aug 18, 2019
a93c6b3
Merge branch 'dev' of https://github.com/sphericalpm/Eriwan into feat…
AndreyAnokhin Aug 18, 2019
c6eb2f1
Merge branch 'dev' into features/user_profile
AndreyAnokhin Aug 18, 2019
9eefc06
Registration template changes for flask-bootstrap
xzwache Aug 18, 2019
78d9651
Merge pull request #32 from sphericalpm/RegisterTemplate_botastrap_ch…
CHuKeR Aug 18, 2019
ae41d76
configure drop-zone
AlexeyRadchenko Aug 18, 2019
1e7ee14
fix merge conflict
AlexeyRadchenko Aug 18, 2019
3c1599c
Delete flash messages in profile
AndreyAnokhin Aug 18, 2019
05a4a44
Merge branch 'features/user_profile' of https://github.com/sphericalp…
AndreyAnokhin Aug 18, 2019
e03949f
try to deploy on docker
Aug 18, 2019
16baeb3
add user-profile edit function
Mo1far Aug 18, 2019
f413aad
Merge branch 'features/user_profile' of https://github.com/sphericalp…
Mo1far Aug 18, 2019
3c27777
Merge pull request #33 from sphericalpm/features/user_profile
AndreyAnokhin Aug 18, 2019
7fc2737
last line added
Kvm99 Aug 18, 2019
8bfa36d
chaned *.mp3 to app/media/ cause we need .mp3 file in tests/
Kvm99 Aug 18, 2019
f87acff
correct tests
Kvm99 Aug 18, 2019
a549664
added uwsgi into req.txt
Aug 18, 2019
94c4002
flake9 changes
Kvm99 Aug 18, 2019
e19acb1
added app dependencies into dockerfile
Aug 18, 2019
cc1ba83
Merge branch 'feature/speech_synthesis' of https://github.com/spheric…
Kvm99 Aug 18, 2019
553263e
deleted because now it's in app/audio_utils.py
Kvm99 Aug 18, 2019
7840cdb
added firefox into /opt/firefox
Aug 18, 2019
a3d49b8
change block scripts add commetn for dropzone in app init
AlexeyRadchenko Aug 18, 2019
6e54a63
correct added /app/media
Kvm99 Aug 18, 2019
4be1d82
media/ corrected
Kvm99 Aug 18, 2019
2b77c72
necessary mp3 added
Kvm99 Aug 18, 2019
c6b3f66
fix merge conflict
AlexeyRadchenko Aug 18, 2019
4aa5c92
fix merge conflict
AlexeyRadchenko Aug 18, 2019
6126b43
Rss is done, before conflicts
Aug 18, 2019
5ecb334
add media/episodes
AlexeyRadchenko Aug 18, 2019
478f3e2
add media/episodes
AlexeyRadchenko Aug 18, 2019
3dc75ce
Create episodes
AlexeyRadchenko Aug 18, 2019
70c7046
Delete episodes
AlexeyRadchenko Aug 18, 2019
4a5f832
Create episodes
AlexeyRadchenko Aug 18, 2019
979da8a
Merge remote-tracking branch 'origin/feature/speech_synthesis' into dev
dschglv Aug 18, 2019
6fed927
added pytest to requirements
dschglv Aug 18, 2019
3384e1c
Merge branch 'dev' of https://github.com/sphericalpm/Eriwan into add_…
Aug 18, 2019
74d577d
add create mp3 file for jokes
Aug 18, 2019
ac052cf
add beauty to base template
Aug 18, 2019
1413e1b
add upload podcast page for refistered user
AlexeyRadchenko Aug 18, 2019
4dcda3c
Merge pull request #35 from sphericalpm/deployment
Aug 18, 2019
2f3c53a
fix merge conflit in config.py
AlexeyRadchenko Aug 18, 2019
1b4f47d
fix merge conflit in requirements
AlexeyRadchenko Aug 18, 2019
d0a9ae5
creating a message for the user after loading
Mo1far Aug 18, 2019
f0f52f7
episodes
AlexeyRadchenko Aug 18, 2019
dd5f1f2
merged conflict
Kvm99 Aug 18, 2019
bfce75e
create link for registration in navbar for anonymous users
Mo1far Aug 18, 2019
ae31225
Refactoring
Aug 18, 2019
46a247e
hotfix docker
Aug 18, 2019
933807b
correct merge of conflicts
Kvm99 Aug 18, 2019
ee2d622
fix form
Aug 18, 2019
a34e655
Merge branch 'dev' of https://github.com/sphericalpm/Eriwan into feat…
Kvm99 Aug 18, 2019
457fd4b
Merge remote-tracking branch 'origin/upload-file-and-template' into u…
Mo1far Aug 18, 2019
1f905ba
correct merge conflicts
Kvm99 Aug 18, 2019
b5a91a7
fix reference
Mo1far Aug 18, 2019
61cd413
Merge remote-tracking branch 'origin/upload-file-and-template' into u…
Aug 18, 2019
9796cff
fix
Aug 18, 2019
02626e2
Merge remote-tracking branch 'origin/upload-file-and-template' into u…
Aug 18, 2019
4854122
fix pep8
Aug 18, 2019
5dd1afc
fix validate
Aug 18, 2019
3a7a6bd
Merge pull request #37 from sphericalpm/add_joke
CHuKeR Aug 18, 2019
0bf8e51
added import login_manager
Kvm99 Aug 18, 2019
5fdff07
added into /add_joke concatenation with jingle and speech synthesis
Kvm99 Aug 18, 2019
93860b5
fix required input
Mo1far Aug 18, 2019
e5907af
merged conflict
Kvm99 Aug 18, 2019
422bf83
Merge pull request #34 from sphericalpm/upload-file-and-template
CHuKeR Aug 18, 2019
82863ff
merged conflict in requirements
Kvm99 Aug 18, 2019
817190a
hotfix requirements.txt
Aug 18, 2019
743e584
added generate_wrapped_file in upload-podcast
Kvm99 Aug 18, 2019
481dbcd
wrong changes deleted
Kvm99 Aug 18, 2019
7607c84
deleted pydub withoue version
Kvm99 Aug 18, 2019
1af9279
added call to generate_wrapped_file function in /upload-podcast route
dschglv Aug 18, 2019
c444d7b
fix docker-compose
Aug 18, 2019
12fa4bd
fix template
Mo1far Aug 18, 2019
487f8d9
Merge pull request #39 from sphericalpm/upload-file-and-template
Aug 18, 2019
ef6a5af
Merge pull request #40 from sphericalpm/feature/speech_synthesis
Aug 18, 2019
600a99b
readme modified
Kvm99 Aug 18, 2019
b33f088
added media/
Kvm99 Aug 18, 2019
37f0adb
Merge branch 'dev' of https://github.com/sphericalpm/Eriwan into feat…
Kvm99 Aug 18, 2019
cabdaa5
Merge pull request #41 from sphericalpm/feature/speech_synthesis
Kvm99 Aug 18, 2019
1360f49
Bag fixing, lintering by flake8
Aug 18, 2019
f57094d
fix volume docker-compose
Aug 18, 2019
1e8e3d3
fix template
Mo1far Aug 18, 2019
2b56295
Merge branch 'feature/rss' of https://github.com/sphericalpm/Eriwan i…
Mo1far Aug 18, 2019
05942bb
Merge branch 'dev' into feature/rss
AndreyAnokhin Aug 18, 2019
5de3cdd
Merge pull request #38 from sphericalpm/feature/rss
AndreyAnokhin Aug 18, 2019
d9f5156
Bag fixing, lintering by flake8
Aug 18, 2019
89017c4
fix requirements.txt
Aug 18, 2019
fbbe0c3
fix template
Mo1far Aug 18, 2019
3ac77e7
another fix volumes
Aug 18, 2019
6d0e2d8
fixxx
Mo1far Aug 18, 2019
e102390
fixxx
Mo1far Aug 18, 2019
8117edf
added route for play audio
Kvm99 Aug 18, 2019
520f0ab
Merge pull request #42 from sphericalpm/feature/speech_synthesis
Kvm99 Aug 18, 2019
7b65477
Merge branch 'feature/rss' of https://github.com/sphericalpm/Eriwan i…
Mo1far Aug 18, 2019
49849cc
Merge branch 'dev' into feature/rss
CHuKeR Aug 18, 2019
d79e2df
Merge pull request #43 from sphericalpm/feature/rss
CHuKeR Aug 18, 2019
586031f
fixxx
Mo1far Aug 18, 2019
a881c3c
fix for rss feed
Mo1far Aug 18, 2019
0531e75
Merge branch 'feature/rss' of https://github.com/sphericalpm/Eriwan i…
Mo1far Aug 18, 2019
cad1686
Merge branch 'dev' of https://github.com/sphericalpm/Eriwan into feat…
Mo1far Aug 18, 2019
26615dd
Merge pull request #46 from sphericalpm/feature/rss
CHuKeR Aug 18, 2019
c3b0cc9
Update README.md
Kvm99 Aug 18, 2019
70cb409
Update README.md
Kvm99 Aug 18, 2019
7fdf466
Fix route in edit_joke
xzwache Aug 18, 2019
8838653
Merge pull request #45 from sphericalpm/EditJokeRouteFix
CHuKeR Aug 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ venv.bak/
# Spyder project settings
.spyderproject
.spyproject
yandex_tokens.py
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we using yandex tokens in the final version? 


# Rope project settings
.ropeproject
Expand All @@ -105,3 +106,12 @@ venv.bak/

# direnv
.envrc

# audio files:
app/media/
media/
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a great idea to store files created by your code in the same directories as the code itself


# ideas
.idea/
.vscode
app.db
24 changes: 24 additions & 0 deletions Dockerfile-flask
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# We simply inherit the Python 3 image. This image does
# not particularly care what OS runs underneath
FROM python:3
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use a ready-made flask image? 

# Set an environment variable with the directory
# where we'll be running the app
ENV APP /app
# Create the directory and instruct Docker to operate
# from there from now on
RUN mkdir $APP
WORKDIR $APP
# Expose the port uWSGI will listen on
EXPOSE 5000
# Copy the requirements file in order to install
# Python dependencies
COPY requirements.txt .
# App dependencies
RUN apt-get update && apt-get install -y ffmpeg
# Install Python dependencies
RUN pip install -r requirements.txt
# We copy the rest of the codebase into the image
COPY . .
# Finally, we run uWSGI with the ini file we
# created earlier
CMD [ "uwsgi", "--ini", "app.ini" ]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new line at end of file

9 changes: 9 additions & 0 deletions Dockerfile-nginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM nginx:latest
# Nginx will listen on this port
EXPOSE 80
# Remove the default config file that
# /etc/nginx/nginx.conf includes
RUN rm /etc/nginx/conf.d/default.conf
# We copy the requirements file in order to install
# Python dependencies
COPY app.conf /etc/nginx/conf.d
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new line at end of file

11 changes: 11 additions & 0 deletions HOW TO RUN FLASK APP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# HOW TO RUN FLASK APP
```sh
export FLASK_APP=eriwan_podcast.py
export FLASK_DEBUG=1

flask db init
flask db migrate
flask db upgrade

flask run
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flask run is only good enough for development. More on this https://flask.palletsprojects.com/en/1.1.x/tutorial/deploy/#run-with-a-production-server

```
52 changes: 27 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
# Eriwan
This is a repository for the test task of Spherical Internship August 2019
# Eriwan. Test task of Spherical Internship August 2019. Version 1.0

First call agenda:
1. Linter tool - flake8
2. Git branch strategy
3. Project environment: optional (majority for flake8)
4. Python version: 3.7
5. Pytest/unitest/nose: optional (majority for pytest)
6. Code Master: pending
6.1. Code review: first responder
7. Data Base: Sqlite
8. Flask
9. Queue: celery?
10. Upload file size limits: 20 Megabytes
11. Audio file format: mp3?
12. Frontend: Bootsrap + jinja
## Eriwan
-------------
Web servis for public podcast creation where each user can add episodes and
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling. I will only make this comment once about human-readable content here, though spelling is not great across the board. Spelling is very important. Misspelled words will not be found by search, making navigation in your code, comments and documentation very difficult.

admin could add jokes.
Jokes go through speech syntesis and concatinate with jingle before and after.
Episode's name go through speech syntesis and concatinate with episodes.
Podcast destributed by RSS/Atom feed.
Servis has admin and user authorisation forms.
Also admin can delete or change jokes.

Podcast structure:
1. 1st audio: jingle + joke + jungle;
2. 2nd audio: name of episode + episode
3. Podcast language: Russian
4. Speech synthesis: gTTS

## Usage
-------------
To use Eriwan you should follow next steps:
```
export FLASK_APP=eriwan_podcast.py
flask run
```
or just go to http://68.183.145.62/
Required modules you can find in requirements.txt

Poll results:
1. First meeting time: 10:00 (GMT+3)
2. Second meeting saturday 19.00 (GMT+3)
## Contributing
-------------
It's a hackathon-like project, we know this might not be the perfect. If you have any ideas, just open an issue and tell us what you think.

If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.

3. Communication language: Russian

## Licensing
-------------
This project is licensed under MIT license. This license allows unlimited redistribution for any purpose as long as its copyright notices and the license's disclaimers of warranty are maintained.
9 changes: 9 additions & 0 deletions app.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
server {
listen 80;
root /usr/share/nginx/html;
location / { try_files $uri @app; }
location @app {
include uwsgi_params;
uwsgi_pass flask:5000;
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new line at end of file

16 changes: 16 additions & 0 deletions app.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[uwsgi]
protocol = uwsgi
; This is the name of our Python file
; minus the file extension
module = eriwan_podcast
; This is the name of the variable
; in our script that will be called
callable = app
master = true
; Set uWSGI to start up 5 workers
processes = 5
; We use the port 5000 which we will
; then expose on our Dockerfile
socket = 0.0.0.0:5000
vacuum = true
die-on-term = true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new line at end of file

37 changes: 37 additions & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from flask import Flask
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_bootstrap import Bootstrap
from flask_dropzone import Dropzone
from flask_wtf.csrf import CSRFProtect

from config import Config

app = Flask(__name__)

# using Config class from ./config.py
app.config.from_object(Config)

# database
db = SQLAlchemy(app)
migrate = Migrate(app, db)

# authorization
login_manager = LoginManager(app)

#styles
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting: either leave a space after the # or don't, the usage inconsistent style is annoying for the reader and may hinder navigation

bootstrap = Bootstrap(app)

from .rss import RssResponse
app.response_class = RssResponse
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is happening here? 


# podcast upload dropzone
dropzone = Dropzone(app)
csrf = CSRFProtect(app)


# The routes module is imported at the bottom and not at the top of the script
# as it is always done. The bottom import is a workaround to circular imports,
# a common problem with Flask applications.
from app import routes, models, errors
28 changes: 28 additions & 0 deletions app/audio_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from pydub import AudioSegment
from gtts import gTTS
import tempfile
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import order: 1. stdlib 2. third-party modules 3. project-local modules. Within each section: import ... before from ... import ...



def text_to_speech(text):
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all method names shall contain a verb. All methods do something and their names should clearly state what they do

"""
takes text, makes Russian speech, saved into temporary mp3 file
"""
temporary_file = tempfile.NamedTemporaryFile(suffix=".mp3", delete=False)
tts = gTTS(text=text, lang='ru')
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and across the project: use one quote style. Preferably single quotes, but most importantly one style across the project

tts.save(temporary_file.name)

return temporary_file.name


def concatenate_audios(path_list, out_path):
"""
Concatenate audios into one file
:param out_path: path for saving mp3 file
:param path_list: audio path list
:return:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, what does this method return? Generally, what happens if it couldn't deliver the expected result? 

"""

res = AudioSegment.empty()
for audio_path in path_list:
res += AudioSegment.from_mp3(audio_path)
res.export(out_path, format='mp3')
15 changes: 15 additions & 0 deletions app/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Handle route and server exceptions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless comment

from flask import render_template
from app import app
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better leave an empty line between groups of imports (see above)

from app import db


@app.errorhandler(404)
def not_found_error(error):
return render_template('404.html'), 404


@app.errorhandler(500)
def internal_error(error):
db.session.rollback()
return render_template('500.html'), 500
105 changes: 105 additions & 0 deletions app/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
from wtforms import StringField, PasswordField, SubmitField, BooleanField
from wtforms.validators import DataRequired, Length, Email, EqualTo,\
ValidationError
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed, FileRequired

from app.models import User


class RegistrationForm(FlaskForm):
username = StringField(
'Имя пользователя',
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and ahead: mixing code and content, especially content in non-Latin script, is a bad idea.

render_kw={"placeholder": "Ваше имя пользователя"},
validators=[
DataRequired(),
Length(min=2, max=64)])
email = StringField(
'Почтовый ящик',
render_kw={"placeholder": "you@example.com"},
validators=[
DataRequired(),
Email()])
password = PasswordField(
'Пароль',
validators=[
DataRequired(),
Length(min=3, max=25)])
confirm_password = PasswordField(
'Подтверждение пароля',
validators=[
DataRequired(),
Length(min=3, max=25),
EqualTo('password')])
submit = SubmitField('Зарегистрироваться')

@staticmethod
def validate_username(self, username):
user = User.query.filter_by(username=username.data).first()
if user:
raise ValidationError('Это имя пользователя уже занято. Пожалуйста \
выберите другое.')

@staticmethod
def validate_email(self, email):
email = User.query.filter_by(email=email.data).first()
if email:
raise ValidationError('Этот почтовый ящик уже занят. Пожалуйста \
выберите другое.')


class LoginForm(FlaskForm):
username = StringField("Имя пользователя", validators=[DataRequired()])
password = PasswordField("Пароль", validators=[DataRequired()])
remember_me = BooleanField("Запомнить меня")
submit = SubmitField("Войти")


class UploadJokeForm(FlaskForm):
"""
Form for Jokes:
:parameter:
text - Joke text;
submit - submit button;
"""
text = StringField('Текст шутки', validators=[DataRequired()])
submit = SubmitField('Сохранить')


class EditJokeForm(FlaskForm):
text = StringField("Текст", validators=[DataRequired()])
submit = SubmitField("Редактировать")


class EditUserProfileForm(FlaskForm):
username = StringField(
'Имя пользователя',
render_kw={"placeholder": "Новое имя пользователя"},
validators=[
DataRequired(),
Length(min=2, max=64)])
old_password = PasswordField(
'Старый пароль',
validators=[
DataRequired(),
Length(min=3, max=25)])
password = PasswordField(
'Новый пароль',
validators=[
DataRequired(),
Length(min=3, max=25)])
confirm_password = PasswordField(
'Подтверждение пароля',
validators=[
DataRequired(),
Length(min=3, max=25),
EqualTo('password')])
submit = SubmitField('Редактировать')


class EpisodeUploadForm(FlaskForm):
file = FileField('Upload podcast', validators=[
FileRequired(),
FileAllowed(['mp3'], "Wrong format! Only mp3 format audio files")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use different quotes style?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, we are mixing interface languages? 

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and single and double quotes on the same line!

])
title = StringField('Имя подкаста', validators=[DataRequired()])
Loading