How to query database after the server has started? [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am trying to Query my database after the server has started, all of the tutorials on youtube write the code inside the server and run it. I don't want this, on the official tutorial they execute the commands inside a shell. How do I do the same?

the Django docs that you mentioned here making queries is using interactive Python shell configured for your Django project, to access that you can run the following command
python manage.py shell
from there you can access all those commands

Related

How to deploy a python chatbot [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I am a beginner of chatbot, I have developed python code to do pattern match from an intents.json file. code works fine and can answer questions.
But how to embed this python file and intents.json file into a site as a chatbot widget? Appreciate if any good tutorial for end-to-end chatbot project. Thank you.
Browsers do not run Python, so you would need to write an API. You can use Flask to do so fairly easily. Flask's tutorial is excellent.
An alternative would be to write a Javascript version that can run in the browser. This avoids the Flask server, but then people could easily jack your chatbot.

Can a python file run on a Raspberry Pi? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have developed a webserver in Python (using Bottle). In this moment it runs on my laptop, but in future it will run on a board (like Raspberry).
The webserver shows a html page that allow to the users to put some data and it should save locally in a file.
Is it possible? I have to use php?
Thanks
You can just run your python apps on a Raspberry Pi. There are many tutorials on the web.
Video:
https://www.youtube.com/watch?v=VFs1dhJPYa4
Tutorials:
https://makezine.com/projects/program-raspberry-pi-with-python/
http://www.makeuseof.com/tag/10-raspberry-pi-projects-beginners/
http://www.techradar.com/news/software/learn-to-program-your-raspberry-pi-1148194/2

run a code every 5 minutes when django server is running [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a django project and inside I have an app. Inside this app I created a management folder, inside this one I create a commands folder, and inside the last one I put my script with the init.py file too. My question is: how can I do to autorun that code every X minutes once the server is running to don't worry about execute the script myself.
You can refer, django-chronograph is a simple application that allows you to control the frequency at which a Django management command gets run.
chronograph
Hope this is helps you.

Python (3.4) run SSH commands on local terminal [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm writing a script that I'm running through a terminal, and would like it to run BASH commands in that same terminal. All solutions that I found were geared toward connecting remotely through SSH, whereas I just need to run SSH commands on the same machine.
Can someone please point in a direction how that can be done, since Googling didn't really give me relevant results.
You might be looking for the subprocess module. You can do (for example):
subprocess.call("<bash command here>", shell = True)
For more details check the documentation.

Web2py launch script [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I need a launch script which has access to "db" and other web2py modules. This script must be running constantly. I know that Web2py has launch parameters from which you can run python files in the web2py enviroment, but i don't know how that works. Can this parameter solve my problem and if so, how do I go about it? Thanks!
Look at section 4.17.1 of the web2py manual (or Google "web2py cron").
You can run a script on startup of web2py by registering it in the crontab file as:
"#reboot web2py *scripts/myscript.py"
web2py should be the username that it will run as, which should be the same as what web2py runs as. In my setup I have a user named 'web2py' to run the app.
The asterix before scripts/myscript.py indicates that you want to run the script in the web2py environment.
Keep in mind that you run the risk of locking issues if your script is trying to use the database at the same time as the normal web2py process.

Categories