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.
Related
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 6 months ago.
Improve this question
I have a parser written in python that sends some date to google sheets. But I want to trigger it from google sheets/GAS. I've deployed my app to heroku. May be it's possible to run it from heroku by triggering in google sheets. I really new to web, so any ideas will be very usefull.
It's not possible now.
Google Workspace supports only Google Apps Script as an integrated environment for Google Sheets.
You have to call your python as a task on your server or as a hook from Google Apps Script trigger.
About the hook
Create a Google Apps Script project. It's fine if you do it from the Sheet
Add the next function to the project
Install a trigger for this function
function actionTrigger(){
UrlFetchApp.fetch('https://<UR_HEROKU_APP_ENDPOINT>');
}
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 2 years ago.
Improve this question
I am looking to export some .py files so I can include them in a website. I am not sure any method to export the files however. Could someone please link some useful information or explain a procedure so the files can be executed using buttons on a website (particularly a HTML site)?
You can use UWSGI as an intermediary between your Python files and nginx (as a web server). But this is not as easy as executing php files, since the php executor comes with any web server. Or call python files as external programs from your existing site.
if your are looking to import function or classes in a file and use them in another file or project, then this might be what you are looking for imports in python
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 3 years ago.
Improve this question
i have a airflow running on GCP as a composer. I an working on a python peoject where i need to dump a remote postgreSQL database to my airflow bucket but the airflow doesn’t allow me to do so. I am wonder, i can run mysqldump on the same instance to so but my requirement is changed and now i want to do the same on postgresql using pg_dump.
You cannot modify the airflow image that runs in Cloud Composer; however, you can use the KubernetesPodOperator to launch a new pod with pg_dump, execute it and upload the file to Cloud Storage.
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
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.