Skip to content

Commit 299c160

Browse files
committed
refactor app: add README + .gitignore
1 parent 6bea89f commit 299c160

File tree

1,943 files changed

+255
-359252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,943 files changed

+255
-359252
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.DS_Store
2+
3+
env/
4+
5+
.env
6+
.vscode
7+
__pycache__/
8+
*.pyc
9+
10+
*.csv
11+
*.xlsx
12+
*.pickle

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<h1 align="center">
2+
Flask blog
3+
</h1>
4+
5+
<p align="center">
6+
<b><i>Development repo for blog project</i></b><br>
7+
Code devoleped following tutorial from Corey Schafer
8+
<a href="https://www.youtube.com/watch?v=MwZwr5Tvyxo&list=PL-osiE80TeTs4UjLw5MM6OjgkjFeUxCYH"><b>Full-Featured Web App</b></a>.
9+
</p>
10+
11+
<p align="center">
12+
<img alt="GitHub code size in bytes" src="https://img.shields.io/github/languages/code-size/api-mzabalza/flaskblog?color=blueviolet" />
13+
<img alt="Number of lines of code" src="https://img.shields.io/tokei/lines/github/api-mzabalza/flaskblog?color=blueviolet" />
14+
<img alt="Code language count" src="https://img.shields.io/github/languages/count/api-mzabalza/flaskblog?color=blue" />
15+
<img alt="GitHub top language" src="https://img.shields.io/github/languages/top/api-mzabalza/flaskblog?color=blue" />
16+
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/api-mzabalza/flaskblog?color=brightgreen" />
17+
</p>
18+
19+
<p align="center"><img src="readme/pic1.png"></p>
20+
21+
22+
<h3 align="center">
23+
<a href="#%EF%B8%8F-about">About</a>
24+
<span> · </span>
25+
<a href="#%EF%B8%8F-usage">Usage</a>
26+
<span> · </span>
27+
<a href="#-testing">Testing</a>
28+
<span> · </span>
29+
<a href="#-useful-links">Useful Links</a>
30+
</h3>
31+
32+
---
33+
34+
## 🗣️ About
35+
> _In this Python Flask Tutorial, we will be learning how to structure a web app using python Flask framework as backend api._
36+
37+
38+
## 🛠️ Usage
39+
40+
### Requirements
41+
42+
The program is written in python language. Find all requirements in requirements.txt file at the root folder.
43+
44+
### Instructions
45+
46+
**2. Setup environment**
47+
* (optinal) create a virtual environment before installing all required dependencies:
48+
```shell
49+
virtualenv env
50+
source env/bin/activate
51+
```
52+
53+
* Install dependecies
54+
```shell
55+
pip install -r requirements.txt
56+
```
57+
58+
**2. Executing the program**
59+
60+
To execute the program, run:
61+
62+
```shell
63+
python app.py
64+
```
65+
66+
## 📋 Testing
67+
68+
(to be written)
69+
70+
## 📌 Useful Links
71+
72+
* [Original source code of the series](https://github.com/CoreyMSchafer/code_snippets/tree/master/Python/Flask_Blog)
73+
* [Youtube tutorial for the project](https://www.youtube.com/watch?v=MwZwr5Tvyxo&list=PL-osiE80TeTs4UjLw5MM6OjgkjFeUxCYH)
74+
* [harm-smits' 42 Docs - minishell](https://harm-smits.github.io/42docs/projects/minishell)
File renamed without changes.

env/.Python

Lines changed: 0 additions & 1 deletion
This file was deleted.

env/bin/activate

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
# This file must be used with "source bin/activate" *from bash*
22
# you cannot run it directly
33

4+
5+
if [ "${BASH_SOURCE-}" = "$0" ]; then
6+
echo "You must source this script: \$ source $0" >&2
7+
exit 33
8+
fi
9+
410
deactivate () {
5-
unset -f pydoc >/dev/null 2>&1
11+
unset -f pydoc >/dev/null 2>&1 || true
612

713
# reset old environment variables
814
# ! [ -z ${VAR+_} ] returns true if VAR is declared at all
9-
if ! [ -z "${_OLD_VIRTUAL_PATH+_}" ] ; then
15+
if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then
1016
PATH="$_OLD_VIRTUAL_PATH"
1117
export PATH
1218
unset _OLD_VIRTUAL_PATH
@@ -40,7 +46,10 @@ deactivate () {
4046
# unset irrelevant variables
4147
deactivate nondestructive
4248

43-
VIRTUAL_ENV="/Users/mzabalza/cs_zab/web/python/flask/coreySchafer/flask-blog/env"
49+
VIRTUAL_ENV='/Users/mzabalza/mzabalza/flask/flaskblog/env'
50+
if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then
51+
VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV")
52+
fi
4453
export VIRTUAL_ENV
4554

4655
_OLD_VIRTUAL_PATH="$PATH"
@@ -54,17 +63,17 @@ if ! [ -z "${PYTHONHOME+_}" ] ; then
5463
fi
5564

5665
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
57-
_OLD_VIRTUAL_PS1="$PS1"
66+
_OLD_VIRTUAL_PS1="${PS1-}"
5867
if [ "x" != x ] ; then
59-
PS1="$PS1"
68+
PS1="${PS1-}"
6069
else
61-
PS1="(`basename \"$VIRTUAL_ENV\"`) $PS1"
70+
PS1="(`basename \"$VIRTUAL_ENV\"`) ${PS1-}"
6271
fi
6372
export PS1
6473
fi
6574

6675
# Make sure to unalias pydoc if it's already there
67-
alias pydoc 2>/dev/null >/dev/null && unalias pydoc
76+
alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true
6877

6978
pydoc () {
7079
python -m pydoc "$@"

env/bin/activate.csh

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,45 @@ alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PA
1010
# Unset irrelevant variables.
1111
deactivate nondestructive
1212

13-
setenv VIRTUAL_ENV "/Users/mzabalza/cs_zab/web/python/flask/coreySchafer/flask-blog/env"
13+
setenv VIRTUAL_ENV '/Users/mzabalza/mzabalza/flask/flaskblog/env'
1414

1515
set _OLD_VIRTUAL_PATH="$PATH:q"
1616
setenv PATH "$VIRTUAL_ENV:q/bin:$PATH:q"
1717

1818

1919

20-
if ("" != "") then
21-
set env_name = ""
20+
if ('' != "") then
21+
set env_name = ''
2222
else
23-
set env_name = "$VIRTUAL_ENV:t:q"
23+
set env_name = '('"$VIRTUAL_ENV:t:q"') '
2424
endif
2525

26-
# Could be in a non-interactive environment,
27-
# in which case, $prompt is undefined and we wouldn't
28-
# care about the prompt anyway.
29-
if ( $?prompt ) then
30-
set _OLD_VIRTUAL_PROMPT="$prompt:q"
31-
if ( "$prompt:q" =~ *"$newline:q"* ) then
32-
:
26+
if ( $?VIRTUAL_ENV_DISABLE_PROMPT ) then
27+
if ( $VIRTUAL_ENV_DISABLE_PROMPT == "" ) then
28+
set do_prompt = "1"
29+
else
30+
set do_prompt = "0"
31+
endif
3332
else
34-
set prompt = "[$env_name:q] $prompt:q"
33+
set do_prompt = "1"
3534
endif
35+
36+
if ( $do_prompt == "1" ) then
37+
# Could be in a non-interactive environment,
38+
# in which case, $prompt is undefined and we wouldn't
39+
# care about the prompt anyway.
40+
if ( $?prompt ) then
41+
set _OLD_VIRTUAL_PROMPT="$prompt:q"
42+
if ( "$prompt:q" =~ *"$newline:q"* ) then
43+
:
44+
else
45+
set prompt = "$env_name:q$prompt:q"
46+
endif
47+
endif
3648
endif
3749

3850
unset env_name
51+
unset do_prompt
3952

4053
alias pydoc python -m pydoc
4154

env/bin/activate.fish

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,38 @@
11
# This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
22
# Do not run it directly.
33

4+
function _bashify_path -d "Converts a fish path to something bash can recognize"
5+
set fishy_path $argv
6+
set bashy_path $fishy_path[1]
7+
for path_part in $fishy_path[2..-1]
8+
set bashy_path "$bashy_path:$path_part"
9+
end
10+
echo $bashy_path
11+
end
12+
13+
function _fishify_path -d "Converts a bash path to something fish can recognize"
14+
echo $argv | tr ':' '\n'
15+
end
16+
417
function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
518
# reset old environment variables
619
if test -n "$_OLD_VIRTUAL_PATH"
7-
set -gx PATH $_OLD_VIRTUAL_PATH
20+
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
21+
if test (echo $FISH_VERSION | head -c 1) -lt 3
22+
set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH")
23+
else
24+
set -gx PATH "$_OLD_VIRTUAL_PATH"
25+
end
826
set -e _OLD_VIRTUAL_PATH
927
end
1028

1129
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
12-
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
30+
set -gx PYTHONHOME "$_OLD_VIRTUAL_PYTHONHOME"
1331
set -e _OLD_VIRTUAL_PYTHONHOME
1432
end
1533

1634
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
35+
and functions -q _old_fish_prompt
1736
# Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
1837
set -l fish_function_path
1938

@@ -30,16 +49,23 @@ function deactivate -d 'Exit virtualenv mode and return to the normal environmen
3049
# Self-destruct!
3150
functions -e pydoc
3251
functions -e deactivate
52+
functions -e _bashify_path
53+
functions -e _fishify_path
3354
end
3455
end
3556

3657
# Unset irrelevant variables.
3758
deactivate nondestructive
3859

39-
set -gx VIRTUAL_ENV "/Users/mzabalza/cs_zab/web/python/flask/coreySchafer/flask-blog/env"
60+
set -gx VIRTUAL_ENV '/Users/mzabalza/mzabalza/flask/flaskblog/env'
4061

41-
set -gx _OLD_VIRTUAL_PATH $PATH
42-
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
62+
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
63+
if test (echo $FISH_VERSION | head -c 1) -lt 3
64+
set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH)
65+
else
66+
set -gx _OLD_VIRTUAL_PATH "$PATH"
67+
end
68+
set -gx PATH "$VIRTUAL_ENV"'/bin' $PATH
4369

4470
# Unset `$PYTHONHOME` if set.
4571
if set -q PYTHONHOME
@@ -56,20 +82,18 @@ if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
5682
functions -c fish_prompt _old_fish_prompt
5783

5884
function fish_prompt
59-
# Save the current $status, for fish_prompts that display it.
60-
set -l old_status $status
85+
# Run the user's prompt first; it might depend on (pipe)status.
86+
set -l prompt (_old_fish_prompt)
6187

6288
# Prompt override provided?
6389
# If not, just prepend the environment name.
64-
if test -n ""
65-
printf '%s%s' "" (set_color normal)
90+
if test -n ''
91+
printf '%s%s' '' (set_color normal)
6692
else
6793
printf '%s(%s) ' (set_color normal) (basename "$VIRTUAL_ENV")
6894
end
6995

70-
# Restore the original $status
71-
echo "exit $old_status" | source
72-
_old_fish_prompt
96+
string join -- \n $prompt # handle multi-line prompts
7397
end
7498

7599
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"

0 commit comments

Comments
 (0)