在 Linux 中创建小型数据库应用程序的最简单方法

发布于 2024-07-13 03:50:14 字数 807 浏览 8 评论 0原文

我正在创建一个非常小的编目应用程序供个人使用(尽管如果我认为其他人会使用它,我会开源它)。 我不想要一个网络应用程序,因为仅仅为此而拥有一个应用程序服务器似乎有点过分了——而且我喜欢它是独立的并将其粘贴在 USB 记忆棒上的想法。

我的标准:

  • 界面必须易于编程。 如果可以更轻松地编写代码,它可以是诅咒风格。 我对 ncurses 的经验表明情况并非如此,但我实际上非常喜欢命令行 UI。
  • 语言其实并不重要。 我的粗略偏好顺序(最高优先):
    • Python
    • C
    • C++
    • Java
    • 我会考虑任何对 Linux 友好的事情
  • 我正在考虑使用 sqlite 进行存储,但欢迎其他(可嵌入)建议。

过去有人做过这种事吗? 有什么建议么? 要避免的陷阱?

编辑:

好吧,看起来 python+sqlite 是早期的赢家。 这就留下了哪个 ui 库的问题。 我知道你可以在 python 中免费获得 tkinter - 但它太丑了(我宁愿有一个curses 界面)。 我已经用 C 语言完成了一些 GTK,但在 python 中看起来相当不自然。 我对 wxwidgets 进行了一次非常简短的尝试,但是文档非常糟糕 IIRC(我认为他们在某个时候重命名了该模块,而且这一切都有点混乱)。

这样我就只剩下 pyqt4 或某种控制台库了。 或者也许 GTK。 想法? 还是我太仓促地取消了上述一项?

I'm looking to create a very small cataloguing app for personal use (although I'd open source it if I thought anyone else would use it). I don't want a web app as it seems like overkill to have an application server just for this - plus I like the idea of it being standalone and sticking it on a USB stick.

My Criterea:

  • Interface must be simple to program. It can be curses-style if that makes it easer to code. My experience with ncurses would suggest otherwise, but I'd actually quite like a commanline UI.
  • Language doesn't really matter. My rough order of preference (highest first):
    • Python
    • C
    • C++
    • Java
    • I'll consider anything linux-friendly
  • I'm thinking sqlite for storage, but other (embeddable) suggestions welcome.

Has anyone done this sort of thing in the past? Any suggestions? Pitfalls to avoid?

EDIT:

Ok, it looks like python+sqlite is the early winner. That just leaves the question of which ui library. I know you get tkinter for free in python - but it's just so ugly (I'd rather have a curses interface). I've done some GTK in C, but it looks fairly un-natural in python. I had a very brief dabble with wxwidgets but the documentation's pretty atrocious IIRC (They renamed the module at some point I think, and it's all a bit confused).

So that leaves me with pyqt4, or some sort of console library. Or maybe GTK. Thoughts? Or have I been too hasty in writing off one of the above?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

怀里藏娇 2024-07-20 03:50:15

对于 GUI,我投票支持 pyqt 或 wx。 (第二,Python+sqlite 投票回答了原来的问题。)

I vote for pyqt or wx for the GUI. (And second the Python+sqlite votes to answer the original question.)

久随 2024-07-20 03:50:15

我第二(或第三)pythonsqlite

就建议而言:

如果您的雄心勃勃,我建议您构建一个非常简单的网络服务来将您的目录同步到服务器。 我过去曾出于类似的目的这样做过(遗憾的是,有几次)。

使用 sqlite,备份实际上就像上传或下载最新的数据库文件一样简单,具体取决于文件的时间戳。

然后,如果您丢失或损坏了闪存驱动器(在我的情况下被摔成碎片),您的目录不会丢失。 您将获得更多的便携性、至少 1 个备份,并且高枕无忧。

I second (or third) python and sqlite.

As far as suggestions are concerned:

If you're feeling minimally ambitious, I'd suggest building a very simple web service to synchronize your catalog to a server. I've done this (ashamedly, a few times) for similar purposes in the past.

With sqlite, backups can literally be as simple as uploading or downloading the latest database file, depending on the file's timestamp.

Then, if you lose or break your flash drive (smashed to pieces, in my case), your catalog isn't lost. You gain more portability, at least 1 backup, and some peace of mind.

自此以后,行同陌路 2024-07-20 03:50:14

我肯定会推荐(或者第二,如果你已经在考虑的话)- python 和 sqlite3。 它简单、便携并且没有大的数据库驱动程序。 我为自己的编目目的编写了一个类似的应用程序,它运行得很好。

I would definitely recommend (or second, if you're already thinking it) - python with sqlite3. It's simple, portable and no big db drivers. I wrote a similar app for my own cataloguing purposes and it's doing just fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文