@Turkish83

Как динамически вставлять результаты скрипта Python3 из PythonAnywhere в страницу WordPress 5.5.1?

Товарищи, прошу помочь!

Есть программа python 3x, выполняемая в постоянном 24/7 режиме, на 5$ акке на PythonAnywhere
Есть WordPress 5.5.1 на ру cms -хостинге.

Как получать данные результата выполнения проги из PythonAnywhere и вставлять их динамически в страницу WordPress.

Куда копать? Совместима ли эта комбинация вообще в принципе? Если да, то как, с чего начать?

На самом PythonAnywhere не так много каментов про WP, только про get и танцы с flask и jango...

Forums
Start a new topic | Back to all topics | This topic's RSS
Wordpress, web2py app and PythonAnywhere

I'd like to integrate a web2py application into my wordpress website under the same domain name. Would PythonAnywhere host them together?
deleted-user-3037407 | 1 post | Nov. 7, 2017, 10:49 p.m. | permalink

that probably wouldn't be possible.
Staff conrad | 3864 posts | PythonAnywhere staff | Nov. 8, 2017, 1:04 p.m. | permalink

I have the same needing. My idea is to register an hosting space with Apache and Linux where install WordPress (this is easy) and point the mysql database on PythonAnywhere via SSH (this is the difficult part).

I can't find an hosting that let users point an external database, so I guess if it is possible.
deleted-user-3653300 | 3 posts | March 29, 2018, 6:54 a.m. | permalink

You could perhaps do it using a VPS -- you could install Apache/Wordpress there, and then run an SSH tunnel using the command at the bottom of this help page. It would require a paid PythonAnywhere account for the SSH, though -- and you'd need to know how to set up the SSH tunnel on the VPS so that it would run constantly and be restarted if the server was rebooted, which would require some Linux sysadmin knowledge.
Staff giles | 9222 posts | PythonAnywhere staff | March 29, 2018, 12:27 p.m. | permalink

I have a kind of similar problem. We have our app on python anywhere but we don't want it to share it directly. Is there any option to share it through IFrame on WordPress website? While doing so it shows blocked by X-Frame options. The IFrame will go here
varshasaini | 1 post | April 17, 2020, 5:23 a.m. | permalink

Is your web app build with Django? As per recent changes in Django https://docs.djangoproject.com/en/3.0/ref/clickjac... x-frame-options are set to deny by default.
Staff fjl | 971 posts | PythonAnywhere staff | April 17, 2020, 10:39 a.m. | permalink
  • Вопрос задан
  • 52 просмотра
Решения вопроса 1
@Lord_Dantes
Куда копать? Совместима ли эта комбинация вообще в принципе? Если да, то как, с чего начать?

В теории:
Результат выводить на рандомную страницу в html сначало попробуйте через python, а потом через WP тяните ajax-ом себе с этой страницы html на нужную страницу.
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
azerphoenix
@azerphoenix
Java Software Engineer
Как получать данные результата выполнения проги из PythonAnywhere и вставлять их динамически в страницу WordPress.

На пайтон реализуйте некий REST Controller, который будет отдавать результат.
Далее ВП по крону обращается по API к этому контроллеру и получает JSON, который уже парсит и вставляет туда куда нужно.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы