Last active
March 11, 2018 17:10
-
-
Save r17x/0c5af1835a19e0a8865eb8a84c8cd0f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| # deklarasi variabel app untuk menampung atau membangun Object Class Framework Flask | |
| app = Flask(__name__) | |
| # deklarasi variable config untuk mengatur konfigurasi dasar dari flask | |
| # port untuk port app flask saat di jalankan | |
| # debug untuk mengaktivkan mode debug jika bernilai benar (True) | |
| config = { | |
| 'port': 5000, | |
| 'debug': True | |
| } | |
| """ | |
| deklarasi rute / atau root path web flask | |
| dengan method Get | |
| http://localhost:port/ | |
| Method atau Function Index | |
| Fungsi yang digunakan ketika | |
| menjalankan atau mengakses route / | |
| return index string | |
| """ | |
| @app.route("/", methods=['GET']) | |
| def index(): | |
| index = "Selamat Datang Di KPM - Membuat ChatBot" | |
| return index | |
| if __name__=="__main__": | |
| try: | |
| app.run(**config) | |
| except ImportError: | |
| print("install : pip install -i requirements.txt") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment