使用python构建数据库_使用Python构建一个极简主义博客(或者,如何学习停止烦恼和热爱Web开发)。

使用python构建数据库

As of today, I have taken my final examination as an undergraduate student of Physics. With my graduate software engineering job beginning in September, I am one graduation ceremony away from being a Software Engineer instead of a Physics Student.

截止到今天,我已经以物理学的本科生参加了期末考试。 从9月开始我的研究生软件工程工作以来,我离成为软件工程师而不是物理学生一个毕业典礼。

Despite the fact that the world needs another programming/tech blog like a hole in the head, I enjoy writing. Given that tech is one of the few subjects on which I’m likely to have something to say, the world will just have to suffer through it. Additionally, my first-choice programming language is Python, and as we know, GitHub is a pythonista’s resume. I see this blog as being a front-page for my GitHub resume.

尽管事实上世界还需要另一个编程/技术博客,例如脑袋上的一个洞,但我还是喜欢写作。 鉴于技术是我可能要说的很少的话题之一,因此世界将不得不为此遭受痛苦。 另外,我的首选编程语言是Python,众所周知, GitHub是pythonista的履历表 。 我将此博客视为GitHub简历的首页。

With that in mind, we should look at the most significant project I’ve hosted on my GitHub: this blog!

考虑到这一点,我们应该看一下我在GitHub上托管的最重要的项目:此博客!

极简博客 (Minimalist Blogging)

Before I started building this blog, I had done almost no web development of any kind. Despite my go-to programming language being Python, the bulk of my extended work has been local applications. Some of these have been in Python, but the bulk have actually been in C# or Java.

在开始构建此博客之前,我几乎没有进行任何形式的Web开发。 尽管我喜欢使用Python作为编程语言,但我的大部分扩展工作还是本地应用程序。 其中一些使用Python,但是大部分实际上使用C#或Java。

None of these have been web apps, however. Given the increasing importance of web applications, it is increasingly indefensible for me to be so totally unfamiliar with web application development.

但是,这些都不是Web应用程序。 鉴于Web应用程序的重要性日益增加,对我完全不熟悉Web应用程序开发的理解越来越难。

My need for a blog and my lack of web application knowledge gave me the opportunity to kill two birds with one stone. So, I resolved that I would build a blog from the ground up.

我对博客的需求以及对Web应用程序知识的缺乏,使我有机会用一块石头杀死两只鸟。 因此,我下定决心要从头开始建立一个博客。

I was able to limit the scope of my job by considering the limited number of things I needed my blog to do. For the moment, at least, it is likely to be very low-traffic, which meant I didn’t need it to handle huge loads or a wide variety of content. I’m technically competent, which means I could write my blog posts in some form of markup, rather than needing a WYSIWYG interface to write them. I don’t expect much in the way of comment spam, so I haven’t implemented a spam filter. In essence, all this blog does is store and display posts and comments.

通过考虑需要博客做的有限的事情,我可以限制我的工作范围。 至少目前,它的流量可能很低,这意味着我不需要它来处理大量的负载或各种各样的内容。 我在技术上很称职,这意味着我可以用某种形式的标记写博客文章,而不需要WYSIWYG界面来编写它们。 我对评论垃圾邮件的期望不高,因此我还没有实施垃圾邮件过滤器。 本质上,此博客所做的只是存储和显示帖子和评论。

Finally, if I was writing Ruby I would probably just have downloaded one of the many, many blog frameworks for Ruby on Rails. Happily, Django exists, so I can write my webapp in Python! Doing things in Python always makes it better.

最后,如果我正在编写Ruby,我可能只会下载Ruby on Rails的众多博客框架之一。 令人高兴的是, Django存在,所以我可以用Python编写我的webapp! 用Python做事总是会让事情变得更好。

是的,但是你说极简主义者? 这似乎还不是最小的。 (Right, but you said Minimalist? This doesn’t seem all that Minimal.)

Part of the minimalism was explained before, with the limited functionality of the blog. The rest of the minimalism was designed in for my own aesthetic appreciation. The blog CSS is based upon the delightfully minimal Skeleton framework with a few adjustments. The blog (in its basic form) uses no Javascript of any kind. We expect to host no static files, so it’s easy to host on Heroku.

之前已经解释了部分极简主义,但博客的功能有限。 其余的极简主义是为了我自己的审美欣赏而设计的。 博客CSS基于令人愉快的最小化Skeleton框架,并进行了一些调整。 该博客(以其基本形式)不使用任何形式的Javascript。 我们希望不承载任何静态文件,因此很容易在Heroku上承载。

As I progressed, I found that this minimalism had some advantages. The absence of an admin GUI interface means that it is significantly more difficult to have your blog stolen or hacked. The lack of Javascript and the relatively simple CSS ensures the page loads fast and looks classy. The absence of Javascript, or of commenting accounts, means that the blog is as privacy-friendly as a blog can possibly be.

随着我的进步,我发现这种极简主义有一些优势。 缺少管理GUI界面意味着博客被盗或被黑客入侵的难度要大得多。 缺少Javascript和相对简单CSS可以确保页面快速加载并看上去优雅。 缺少Javascript或评论帐户,意味着该博客具有与博客一样的隐私友好性。

Finally, the blog code itself is small and (fairly) simple. This makes it easy to deploy and, hopefully, easy to tinker with.

最后,博客代码本身很小,并且(非常)简单。 这使其易于部署,并且希望易于修改。

These advantages mean you can host a blog for very little. You can use a free Heroku account, combined with S3 storage (which is cheap) for the CSS, and get a blog that’s totally under your control for almost nothing. If you want a larger database than Heroku provides, you can always get an EC2 instance. Right now I haven’t, but in the longer term I’ll be considering doing just that. If I do, I’ll probably blog about it.

这些优势意味着您只需花很少的钱就可以托管博客。 您可以使用免费的Heroku帐户,并结合CSS的S3存储(便宜),并获得完全不受您控制的博客。 如果要使用比Heroku提供的数据库更大的数据库,则始终可以获取EC2实例。 现在还没有,但是从长远来看,我会考虑这样做。 如果这样做,我可能会在博客上写有关它。

大。 所以呢? (Great. So what?)

So nothing, really. I wrote some software that I thought my be of interest to others, so I released the non-site-specific stuff for others to use. If you feel like you want a simple self-hosted blog, you should consider adapting this framework for your own use. If you use it and find it is missing a feature you think would be popular, or you need to make some changes to use it on a production server of your own, I would be delighted to accept pull requests. If all you want to do is clean the code up, I’d be happy to accept pull requests for that too.

没事,真的。 我写了一些我认为自己对其他人感兴趣的软件,因此我发布了非特定于站点的东西供他人使用。 如果您想要一个简单的自托管博客,则应考虑调整此框架以供自己使用。 如果您使用它,但发现它缺少您认为会很流行的功能,或者您需要进行一些更改才能在自己的生产服务器上使用它,我将很高兴接受拉取请求。 如果您要做的只是清理代码,我也很乐意接受该请求。

The code should be sufficiently well-contained that you can integrate it with your own Django application as well!

该代码应包含足够完善的代码,以便您也可以将其与自己的Django应用程序集成!

去哪儿? (Where to?)

翻译自: https://www.pybloggers.com/2012/05/building-a-minimalist-blog-in-python-or-how-i-learned-to-stop-worrying-and-love-web-development/

使用python构建数据库

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值