iT邦幫忙

1

(Python) have existing "mySQL Database" and "website", want to connect/synchronize both part

  • 分享至 

  • xImage

ps 我也能說中文,所以留言寫中文我也基本看得懂

問題:我有現成的mySQL Database 跟建成的網站了,要如何連動兩方(我查是可借由python django), 達到我在mySQL Database 輸入或更新資料,能同時同步到wesite上

就不用mySQL Database 寫一次,html 再更新一次


Main problem: I have existing mySQL Database and website, how do I connect/synchronize both, that input or update from mySQL, can also result in website too

I did learn HTML, CSS but was required to find the way, instead input from <p> </p>, need to find a way CRUD from mySQL, and result to website

after a day of research, python django seems has the possiblity solve my problem, but all the tutorial is buttom up create an new website and new mySQL, I'm stock on connecting existing one (that the "mySQL Database" and "website"), that how far I reach , therefore want to ask the export in here, thanks

environment: I'm using python, window and mySQL

  • the already set website screenshot
    the already set website screenshot

  • the existing mySQL Database screenshot (MySQL Database, and using HeidiSQL )

the existing mySQL Database screenshot


the specific example:
if I update/change the context Nordic as Nike from mySQL, by success connect both, the website part the Nike can replace Nordic as new topic

enter image description here

obarisk iT邦研究生 2 級 ‧ 2023-01-04 09:42:22 檢舉
你在找樣版(templates)?也許關鍵字是 django + templates 吧?
froce iT邦大師 1 級 ‧ 2023-01-04 11:43:38 檢舉
https://docs.djangoproject.com/en/4.1/

django 只要設定好Database的連線資訊,可以自動幫你產出model(用python manage.py inspectdb),學會template就能帶出了。
https://docs.djangoproject.com/en/4.1/howto/legacy-databases/
jton iT邦新手 5 級 ‧ 2023-01-05 09:58:32 檢舉
謝謝,目前是有成功連接上 `django 到 mySQL`, 如果是希望達到動 mySQL, website 也能跟著動完, 我還需要研究怎麼連接 `django 到 website` 或 `mySQL到 website`
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

1

英文我沒辦法,如果你看的懂中文的話。我就直接中文解釋。

其實有很多網頁應用都能做到。你說的 Python 只是其中一種。
其餘像是 PHP .net java nodejs .......
這些對應的 WEB應用 。都能辦到你說的事。

但如果你說使用單純的html。
那就只剩下唯一一種方式了。就是AJAX的請求模式。

當然還是需要後端應用。只是利用了前端語言等AJAX的方式來去跟後端請求資料後
再回應回來更新網頁。

如用後端語言來出網頁。可以在取得資料後,直接呈現資料到網頁上。
但如果不是使用後端語言的情況下。就只能異步處理。

以上的中文不知道你是否了解。

jton iT邦新手 5 級 ‧ 2023-01-04 08:42:57 檢舉

能懂你說的

因為我主要用 PYTHON, 所以想連動"mySQL Database" and "website" 我第一個查到的就是 django

但你提的AJAX的請求模式還有異步處理我可以試試


不過我可能會先研究 python django 看怎麼實現
謝謝您的建議,很實用

我要發表回答

立即登入回答