J Fabian
2 years ago
1276 changed files with 1336 additions and 0 deletions
@ -0,0 +1,4 @@ |
|||
cd /home/joshi/Schreibtisch/pexon/1 |
|||
pipenv install requests |
|||
pipenv shell |
|||
pipenv install flask |
@ -0,0 +1,8 @@ |
|||
apt install docker.io |
|||
apt install docker-compose |
|||
cd /home/joshi/Schreibtisch/pexon/2 |
|||
# docker-compose mit postgresql und adminer erstellt |
|||
docker-compose up |
|||
docker exec -it postgresql /bin/bash |
|||
# postgresql Tabelle sowie zwei Datensätze erstellt |
|||
docker logs postgresql > log.txt |
@ -0,0 +1,36 @@ |
|||
root@ThinkPad-T480s:/home/joshi/Schreibtisch/pexon/3# ansible-playbook HU.yml |
|||
|
|||
|
|||
|
|||
PLAY [all] *********************************************************************************************************************************************************************************************************************************** |
|||
|
|||
TASK [Gathering Facts] *********************************************************************************************************************************************************************************************************************** |
|||
[WARNING]: sftp transfer mechanism failed on [88.218.227.35]. Use ANSIBLE_DEBUG=1 to see detailed information |
|||
ok: [88.218.227.35] |
|||
|
|||
TASK [nginx installation] ******************************************************************************************************************************************************************************************************************** |
|||
[WARNING]: sftp transfer mechanism failed on [88.218.227.35]. Use ANSIBLE_DEBUG=1 to see detailed information |
|||
ok: [88.218.227.35] |
|||
|
|||
TASK [start nginx] *************************************************************************************************************************************************************************************************************************** |
|||
[WARNING]: sftp transfer mechanism failed on [88.218.227.35]. Use ANSIBLE_DEBUG=1 to see detailed information |
|||
ok: [88.218.227.35] |
|||
|
|||
TASK [übertrage die nginx config] ************************************************************************************************************************************************************************************************************ |
|||
ok: [88.218.227.35] |
|||
|
|||
TASK [erstelle symlink] ********************************************************************************************************************************************************************************************************************** |
|||
[WARNING]: sftp transfer mechanism failed on [88.218.227.35]. Use ANSIBLE_DEBUG=1 to see detailed information |
|||
ok: [88.218.227.35] |
|||
|
|||
TASK [html wird übertragen] ****************************************************************************************************************************************************************************************************************** |
|||
changed: [88.218.227.35] |
|||
|
|||
TASK [starte nginx neu] ********************************************************************************************************************************************************************************************************************** |
|||
[WARNING]: sftp transfer mechanism failed on [88.218.227.35]. Use ANSIBLE_DEBUG=1 to see detailed information |
|||
changed: [88.218.227.35] |
|||
|
|||
PLAY RECAP *********************************************************************************************************************************************************************************************************************************** |
|||
88.218.227.35 : ok=7 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 |
|||
|
|||
|
@ -0,0 +1,18 @@ |
|||
|
|||
|
|||
for x in range(1, 101): |
|||
|
|||
y = (x%3) |
|||
z = (x%5) |
|||
|
|||
if y == 0 and z == 0: |
|||
print("FizzBuzz") |
|||
|
|||
elif y == 0: |
|||
print("Fizz") |
|||
|
|||
elif z == 0: |
|||
print("Buzz") |
|||
|
|||
else: |
|||
print(x) |
@ -0,0 +1,12 @@ |
|||
[[source]] |
|||
url = "https://pypi.python.org/simple" |
|||
verify_ssl = true |
|||
name = "pypi" |
|||
|
|||
[packages] |
|||
requests = "*" |
|||
|
|||
[dev-packages] |
|||
|
|||
[requires] |
|||
python_version = "3.8" |
@ -0,0 +1,59 @@ |
|||
{ |
|||
"_meta": { |
|||
"hash": { |
|||
"sha256": "d927fcadfe1cb7a3936766a19e9ff3dd822eca2b5d080bb479058a806e4fe234" |
|||
}, |
|||
"pipfile-spec": 6, |
|||
"requires": { |
|||
"python_version": "3.8" |
|||
}, |
|||
"sources": [ |
|||
{ |
|||
"name": "pypi", |
|||
"url": "https://pypi.python.org/simple", |
|||
"verify_ssl": true |
|||
} |
|||
] |
|||
}, |
|||
"default": { |
|||
"certifi": { |
|||
"hashes": [ |
|||
"sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872", |
|||
"sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569" |
|||
], |
|||
"version": "==2021.10.8" |
|||
}, |
|||
"charset-normalizer": { |
|||
"hashes": [ |
|||
"sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597", |
|||
"sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df" |
|||
], |
|||
"markers": "python_version >= '3'", |
|||
"version": "==2.0.12" |
|||
}, |
|||
"idna": { |
|||
"hashes": [ |
|||
"sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff", |
|||
"sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d" |
|||
], |
|||
"markers": "python_version >= '3'", |
|||
"version": "==3.3" |
|||
}, |
|||
"requests": { |
|||
"hashes": [ |
|||
"sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61", |
|||
"sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d" |
|||
], |
|||
"index": "pypi", |
|||
"version": "==2.27.1" |
|||
}, |
|||
"urllib3": { |
|||
"hashes": [ |
|||
"sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14", |
|||
"sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e" |
|||
], |
|||
"version": "==1.26.9" |
|||
} |
|||
}, |
|||
"develop": {} |
|||
} |
@ -0,0 +1,70 @@ |
|||
|
|||
|
|||
import sqlite3 |
|||
from turtle import up |
|||
from flask import Flask, request, jsonify |
|||
|
|||
app = Flask(__name__) |
|||
|
|||
def db_connect(): |
|||
sqliteconnect = None |
|||
try: |
|||
sqliteconnect = sqlite3.connect('movies.sqlite') |
|||
except sqlite3.Error as error: |
|||
print(error) |
|||
return sqliteconnect |
|||
|
|||
@app.route('/movies', methods=['GET', 'POST']) |
|||
def movies(): |
|||
sqlconnect = db_connect() |
|||
|
|||
if request.method == 'GET': |
|||
cursor = sqlconnect.execute("SELECT * FROM movie") |
|||
movies = [ |
|||
dict(id=row[0], movie_title=row[1]) |
|||
for row in cursor.fetchall() |
|||
] |
|||
if movies is not None: |
|||
return jsonify(movies) |
|||
|
|||
if request.method == 'POST': |
|||
newmovie = request.form['movie_title'] |
|||
sql = f"INSERT INTO movie (movie_title) VALUES ('{newmovie}')" |
|||
print(sql) |
|||
sqlconnect.execute(sql) |
|||
sqlconnect.commit() |
|||
return "Der Film wurde erfolgreich erstellt" |
|||
|
|||
@app.route('/movie/<int:id>', methods=['GET', 'PUT', 'DELETE']) |
|||
def single_movie(id): |
|||
sqlconnect = db_connect() |
|||
cursor = sqlconnect.cursor() |
|||
movie = None |
|||
if request.method == 'GET': |
|||
cursor.execute(f"SELECT * FROM movie WHERE id={id}") |
|||
rows = cursor.fetchall() |
|||
for r in rows: |
|||
movie = r |
|||
if movie is not None: |
|||
return jsonify(movie), 200 |
|||
else: |
|||
return f"Film mit der id:{id} wurde nicht gefunden", 404 |
|||
if request.method == 'PUT': |
|||
movie = request.form['movie_title'] |
|||
sql = f"UPDATE movie SET movie_title='{movie}' WHERE id={id}" |
|||
sqlconnect.execute(sql) |
|||
sqlconnect.commit() |
|||
|
|||
update_movie = { |
|||
'id': id, |
|||
'movie_title': movie |
|||
} |
|||
|
|||
return jsonify(update_movie) |
|||
if request.method == 'DELETE': |
|||
sql = f"DELETE FROM movie WHERE id={id}" |
|||
sqlconnect.execute(sql) |
|||
sqlconnect.commit() |
|||
return jsonify(f"Der Film mit der id:{id} wurde gelöscht") |
|||
if __name__ == '__main__': |
|||
app.run() |
@ -0,0 +1,11 @@ |
|||
from flask import Flask |
|||
|
|||
app = Flask(__name__) |
|||
|
|||
|
|||
@app.route('/') |
|||
def index(): |
|||
return 'Hello World' |
|||
|
|||
|
|||
print('test') |
Binary file not shown.
@ -0,0 +1,10 @@ |
|||
import sqlite3 |
|||
|
|||
sqlconnect = sqlite3.connect("movies.sqlite") |
|||
|
|||
#cursor = sqlconnect.cursor() |
|||
sql_query = """ CREATE TABLE movie( |
|||
id integer PRIMARY KEY autoincrement, |
|||
movie_title varchar(50) NOT NULL |
|||
)""" |
|||
sqlconnect.execute(sql_query) |
@ -0,0 +1 @@ |
|||
14 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue