Jul-27-2019, 05:04 AM
I don't remember exactly but you might have to type "string" rather than "str"
Flask: Making my first web site
|
Jul-27-2019, 05:04 AM
I don't remember exactly but you might have to type "string" rather than "str"
Jul-27-2019, 11:24 AM
Correct. Wondering why is standard 'str' not set.
Jul-27-2019, 10:54 PM
By the way, the author of the course mentioned that he added this json with posts
https://github.com/CoreyMSchafer/code_sn...posts.json Could anyone tell me how to actually add it? Never had any business with json.
Jul-28-2019, 12:31 AM
I think this is what you're looking for - https://realpython.com/python-json/
Jul-28-2019, 11:46 PM
(Jul-28-2019, 12:31 AM)SheeppOSU Wrote: I think this is what you're looking for - https://realpython.com/python-json/ I created a list json_data ( had to use raw github link ) import requests import json raw_json = requests.get("https://raw.githubusercontent.com/CoreyMSchafer/code_snippets/master/Python/Flask_Blog/snippets/posts.json") json_data = json.loads(raw_json.content)now just to figure out where to put this. ![]()
Can anybody please help me with this error
The mess started when I decided to change the name of my root folder from 'Environments' to more suitable 'Projects'. So now I have Projects/Flask_blog and within Flask_blog have run.py and flaskblog subfolder with all the code for the web site.now ran run.py again and got this:
Aug-13-2019, 03:14 PM
You have not set to SQLALCHEMY_TRACK_MODIFICATIONS to False as you metion before in post.
Add line 2. app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://site.db' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False Quote:The mess started when I decided to change the name of my root folder from 'Environments' to more suitable 'Projects'. So now I have Projects/Flask_blog and within Flask_blog have run.py and flaskblog subfolder with all the code for the web site.Just clone from GitHub as Corery has all step in blog tutorial there.
I added
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False but it didn't give me desired outcome. Still the same problem. I guess I'll have to clone the whole code_snippets repository.Thank you. After cloning to my project folder starting run.py and trying to open a web site leads to this error
(Aug-13-2019, 11:14 PM)Truman Wrote: I guess I'll have to clone the whole code_snippets repository.I told in in post #2 about DownGit or cooler GitZip where can download individual files and folder. Quote:After cloning to my project folder starting run.py and trying to open a web site leads to this errorYou most link to what where you are,should not be necessary to mention this ![]() Link if i test eg 08-Posts .Here a run,i delete database site.db so i can make new one.G:\all_flask\08-Posts λ ls flaskblog/ run.py # Make database site.db G:\all_flask\08-Posts λ ptpython >>> from flaskblog import db >>> db.create_all() >>> exit()Add line 2: app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://site.db' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = FalseTest run: G:\all_flask\08-Posts λ python run.py * Serving Flask app "flaskblog" (lazy loading) * Environment: production WARNING: Do not use the development server in a production environment. Use a production WSGI server instead. * Debug mode: on * Restarting with stat * Debugger is active! * Debugger PIN: 334-187-997 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) 127.0.0.1 - - [14/Aug/2019 16:19:21] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [14/Aug/2019 16:19:21] "GET /static/main.css HTTP/1.1" 200 - 127.0.0.1 - - [14/Aug/2019 16:19:21] "GET /favicon.ico HTTP/1.1" 404 - 127.0.0.1 - - [14/Aug/2019 16:20:09] "GET /about HTTP/1.1" 200 - 127.0.0.1 - - [14/Aug/2019 16:20:10] "GET /home HTTP/1.1" 200 - 127.0.0.1 - - [14/Aug/2019 16:20:13] "GET /register HTTP/1.1" 200 - 127.0.0.1 - - [14/Aug/2019 16:20:28] "POST /register HTTP/1.1" 302 - 127.0.0.1 - - [14/Aug/2019 16:20:28] "GET /login HTTP/1.1" 200 - 127.0.0.1 - - [14/Aug/2019 16:20:32] "GET /login HTTP/1.1" 200 -No error site work and i can register a new user,and New Post message get added to database.
|
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Moving flask app to sub folder on live site. Help This is driving me crazy **huh** | Rosssaab | 1 | 881 |
Jan-10-2025, 02:11 PM Last Post: menator01 |
|
Flask - Opening second page via href is failing - This site can’t be reached | rafiPython1 | 2 | 6,440 |
Apr-11-2018, 08:41 AM Last Post: rafiPython1 |