You can find the corresponding tutorials on my channel: https://www.youtube.com/c/PythonEngineer
patrickloeber / python-fun Goto Github PK
View Code? Open in Web Editor NEWSome fun and useful projects with Python
License: MIT License
Some fun and useful projects with Python
License: MIT License
You can find the corresponding tutorials on my channel: https://www.youtube.com/c/PythonEngineer
bro can u help me i wrote this code in vs code but when i run app. py it runs only in terminal and the gui window doesnt appear i have properly installed tkinter still it runs in terminal only
Home screen is blank, and http://127.0.0.1:5000/add returns :method not allowed error
Tried using the code. But for all keywords it says the same " found 0 images"
➜ fastapi git:(master) ✗ uvicorn app:app --reload
INFO: Will watch for changes in these directories: ['~/....../python-fun/webapps/fastapi']
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [2387967] using watchgod
INFO: Started server process [2387969]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: 127.0.0.1:58440 - "GET / HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "~/.local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 372, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "~/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
return await self.app(scope, receive, send)
File "~/.local/lib/python3.8/site-packages/fastapi/applications.py", line 259, in __call__
await super().__call__(scope, receive, send)
File "~/.local/lib/python3.8/site-packages/starlette/applications.py", line 119, in __call__
await self.middleware_stack(scope, receive, send)
File "~/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
raise exc
File "~/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "~/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 87, in __call__
raise exc
File "~/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 76, in __call__
await self.app(scope, receive, sender)
File "~/.local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "~/.local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 659, in __call__
await route.handle(scope, receive, send)
File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 259, in handle
await self.app(scope, receive, send)
File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 61, in app
response = await func(request)
File "~/.local/lib/python3.8/site-packages/fastapi/routing.py", line 216, in app
solved_result = await solve_dependencies(
File "~/.local/lib/python3.8/site-packages/fastapi/dependencies/utils.py", line 465, in solve_dependencies
response = response or Response(
File "~/.local/lib/python3.8/site-packages/starlette/responses.py", line 50, in __init__
self.init_headers(headers)
File "~/.local/lib/python3.8/site-packages/starlette/responses.py", line 77, in init_headers
and not (self.status_code < 200 or self.status_code in (204, 304))
TypeError: '<' not supported between instances of 'NoneType' and 'int'
INFO: 127.0.0.1:58442 - "GET /favicon.ico HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:58444 - "GET / HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "~/.local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 372, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "~/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
return await self.app(scope, receive, send)
File "~/.local/lib/python3.8/site-packages/fastapi/applications.py", line 259, in __call__
await super().__call__(scope, receive, send)
File "~/.local/lib/python3.8/site-packages/starlette/applications.py", line 119, in __call__
await self.middleware_stack(scope, receive, send)
File "~/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
raise exc
File "~/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "~/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 87, in __call__
raise exc
File "~/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 76, in __call__
await self.app(scope, receive, sender)
File "~/.local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "~/.local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 659, in __call__
await route.handle(scope, receive, send)
File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 259, in handle
await self.app(scope, receive, send)
File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 61, in app
response = await func(request)
File "~/.local/lib/python3.8/site-packages/fastapi/routing.py", line 216, in app
solved_result = await solve_dependencies(
File "~/.local/lib/python3.8/site-packages/fastapi/dependencies/utils.py", line 465, in solve_dependencies
response = response or Response(
File "~/.local/lib/python3.8/site-packages/starlette/responses.py", line 50, in __init__
self.init_headers(headers)
File "~/.local/lib/python3.8/site-packages/starlette/responses.py", line 77, in init_headers
and not (self.status_code < 200 or self.status_code in (204, 304))
TypeError: '<' not supported between instances of 'NoneType' and 'int'
^CINFO: Shutting down
INFO: Waiting for application shutdown.
INFO: Application shutdown complete.
INFO: Finished server process [2387969]
INFO: Stopping reloader process [2387967]
Hi
I was checking web app FLASK https://github.com/patrickloeber/python-fun/tree/master/webapps/flask
But I got this error:
RuntimeError: Working outside of application context.
This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.
➜ todoapp git:(master) ✗ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
February 21, 2022 - 07:59:51
Django version 4.0.2, using settings 'todoapp.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Internal Server Error: /
Traceback (most recent call last):
File "~/.local/lib/python3.8/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "~/.local/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 416, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: todolist_todo
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "~/.local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "~/.local/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "~/Programs/LongerVision/LVT_AI/python-engineer/python-fun/webapps/django/todoapp/todolist/views.py", line 9, in index
return render(request, "base.html", {"todo_list": todos})
File "~/.local/lib/python3.8/site-packages/django/shortcuts.py", line 19, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "~/.local/lib/python3.8/site-packages/django/template/loader.py", line 62, in render_to_string
return template.render(context, request)
File "~/.local/lib/python3.8/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "~/.local/lib/python3.8/site-packages/django/template/base.py", line 176, in render
return self._render(context)
File "~/.local/lib/python3.8/site-packages/django/template/base.py", line 168, in _render
return self.nodelist.render(context)
File "~/.local/lib/python3.8/site-packages/django/template/base.py", line 977, in render
return SafeString(''.join([
File "~/.local/lib/python3.8/site-packages/django/template/base.py", line 978, in <listcomp>
node.render_annotated(context) for node in self
File "~/.local/lib/python3.8/site-packages/django/template/base.py", line 938, in render_annotated
return self.render(context)
File "~/.local/lib/python3.8/site-packages/django/template/defaulttags.py", line 174, in render
len_values = len(values)
File "~/.local/lib/python3.8/site-packages/django/db/models/query.py", line 262, in __len__
self._fetch_all()
File "~/.local/lib/python3.8/site-packages/django/db/models/query.py", line 1354, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "~/.local/lib/python3.8/site-packages/django/db/models/query.py", line 51, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "~/.local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1202, in execute_sql
cursor.execute(sql, params)
File "~/.local/lib/python3.8/site-packages/django/db/backends/utils.py", line 99, in execute
return super().execute(sql, params)
File "~/.local/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "~/.local/lib/python3.8/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "~/.local/lib/python3.8/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "~/.local/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "~/.local/lib/python3.8/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "~/.local/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 416, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: todolist_todo
[21/Feb/2022 08:00:13] "GET / HTTP/1.1" 500 181849
^C%
➜ todoapp git:(master) ✗
If a user were to click on the checkbox twice, then click the "update" button, it would change the status of the task despite there not being an actual change.
python-fun/webapps/flask/app.py
Line 43 in dc8aa51
When a user clicks the "update" button, w.e. the status of the checkbox is should be what the todo.complete
value is set to.
This might require changing the handler from a GET
to a PUT
request so that data can be passed in; or, using a <form>
in the HTML.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.