当前位置: 首页 > 软件库 > Web应用开发 > >

alembic

授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发
软件类型 开源软件
地区 不详
投 递 者 缪风史
操作系统 未知
开源组织
适用人群 未知
 软件概览

Alembic

A Jekyll boilerplate theme designed to be a starting point for any Jekyll website.

Screenshot

Contents

About

Alembic is a starting point for Jekyll projects. Rather than starting from scratch, this boilerplate theme is designed to get rolling immediately. Install it, configure it, tweak it, push it.

Features

  • Available as a theme gem and GitHub Pages theme
  • Clear and elegant design that can be used out of the box or as solid starting point
  • Tested in all major browsers, including IE and Edge
  • Built in Service Worker so it can work offline and on slow connections
  • Configurable colours and typography in a single settings file
  • Extensive set of shortcodes to include various elements; such as buttons, icons, figure images and more
  • Solid typographic framework from Sassline
  • Configurable navigation via a single file
  • Modular Jekyll components
  • Post category support in the form of a single post index page grouped by category
  • Built in live search using JavaScript
  • Contact form built in using Formspree or Netlify Forms
  • Designed with Siteleaf in mind
  • Has 9 of the most popular networks as performant sharing buttons
  • Has documentation

Examples

Here are a few examples of Alembic out in the wild being used in a variety of ways:

Installation

Quick setup

To give you a running start I've put together some starter kits that you can download, fork or even deploy immediately:

  • Vanilla Jekyll starter kit:

  • Forestry starter kit:Deploy to Forestry

  • Netlify CMS starter kit:

  • GitHub Pages with remote theme kit - Download kit

  • Stackbit starter kit:

As a Jekyll theme

  1. Add gem "alembic-jekyll-theme" to your Gemfile to add the theme as a dependancy
  2. Run the command bundle install in the root of project to install the theme and its dependancies
  3. Add theme: alembic-jekyll-theme to your _config.yml file to set the site theme
  4. Run bundle exec jekyll serve to build and serve your site
  5. Done! Use the configuration documentation and the example _config.yml file to set things like the navigation, contact form and social sharing buttons

As a GitHub Pages remote theme

  1. Add gem "jekyll-remote-theme" to your Gemfile to add the theme as a dependancy
  2. Run the command bundle install in the root of project to install the jekyll remote theme gem as a dependancy
  3. Add jekyll-remote-theme to the list of plugins in your _config.yml file
  4. Add remote_theme: daviddarnes/alembic@main to your _config.yml file to set the site theme
  5. Run bundle exec jekyll serve to build and serve your site
  6. Done! Use the configuration documentation and the example _config.yml file to set things like the navigation, contact form and social sharing buttons

As a Boilerplate / Fork

(deprecated, not recommended)

  1. Fork the repo
  2. Replace the Gemfile with one stating all the gems used in your project
  3. Delete the following unnecessary files/folders: .github, LICENSE, screenshot.png, CNAME and alembic-jekyll-theme.gemspec
  4. Run the command bundle install in the root of project to install the jekyll remote theme gem as a dependancy
  5. Run bundle exec jekyll serve to build and serve your site
  6. Done! Use the configuration documentation and the example _config.yml file to set things like the navigation, contact form and social sharing buttons

Customising

When using Alembic as a theme means you can take advantage of the file overriding method. This allows you to overwrite any file in this theme with your own custom file, by matching the file name and path. The most common example of this would be if you want to add your own styles or change the core style settings.

To add your own styles copy the styles.scss into your own project with the same file path (assets/styles.scss). From there you can add your own styles, you can even optionally ignore the theme styles by removing the @import "alembic"; line.

If you're looking to set your own colours and fonts you can overwrite them by matching the variable names from the _settings.scss file in your own styles.scss, make sure to state them before the @import "alembic"; line so they take effect. The settings are a mixture of custom variables and settings from Sassline - follow the link to find out how to configure the typographic settings.

Configuration

There are a number of optional settings for you to configure. Use the example _config.yml file in the repo and use the documentation below to configure your site:

Gem dependency settings

twitter, author and social values will need to be changed to the projects' social information or removed. Look for the Gem settings comment within the /_config.yml file. These values are for the jekyll-seo-tag - follow the link to find out more.

Site settings

You'll need to change the description, title and url to match with the project. You'll also need to replace the logos, default social and default offline images in the /assets/ directory with your own graphics. Setting the site language can be done with lang, the theme will default to en-US. The email needs to be changed to the email you want to receive contact form enquires with. The disqus value can be changed to your project username on Disqus, remove this from the /_config.yml file if you don't want comments enabled. Look for the Site settings comment within the /_config.yml file. The repo setting is optional, for now, and can be removed entirely, if you wish.

Google Analytics can be enabled via the site configuration too. Add your tracking ID to the /_config.yml file in the following method: google_analytics: 'UA-XXXXXXXX-1'. By default all IPs of site visitors are anonymous to maintain a level of privacy for the audience. If you wish to turn this off set the google_analytics_anonymize_ip key to false.

Date format can be customised in the /_config.yml with the option date_format (please refer to Liquid date filters documentation for learning about formatting possibilities). Only placeholder formatting is supported, do not try to use ordinal dates introduced in Jekyll 3.8.

The short_name option within /_config.yml is to add a custom name to the site's web application counterpart. When the website is added to a device this name will appear alonside the app icon. The short name will default to the site title if this isn't set.

Site performance settings

Alembic comes with a couple of options to enhance the speed and overall performance of the site you build upon it.

By default the built in Service Worker is enabled, and will work on a 'network first' method. Meaning if there's no internet connection the content the Service Worker has cached will be used until the connection comes back. It will always look for a live version of the code first. To disable the Service Worker add an option called service_worker with a value of false in the /_config.yml file.

Another option to speed up Alembic is to enable inline CSS, which is off by default. You can enable this by setting css_inline: true inside your /_config.yml file. By switching to inline styles you bypass the use /assets/styles.scss, any custom styles will need to be added in /_includes/site-styles.html or in a new custom file.

Please note that these options aren't a "silver bullet" for making your site faster, make sure to audit and debug your site to get the best performance for your situation.

Site navigation

There are a total of 4 different navigation types:

  • navigation_header: The links shown in the header (it is also used on the 404 page)
  • navigation_footer: The links shown in the footer
  • social_links: The social icon links that are shown in the sidebar
  • sharing_links: The social sharing buttons that are shown at the bottom of blog posts

All navigations can be edited using the _config.yml file. To see example usage either look for the Site navigation comment within the /_config.yml file or see the nav-share.html include.

If there are no items for the navigation_header or navigation_footer, they will fallback to a list of pages within the site. The social_navigation properties should either be one that is already in the list (so Twitter or Facebook) or a regular link, this is so an icon can be set for the link.

Custom fonts

Alembic comes with custom fonts served from Google fonts. By default it requests Merriweather but this can be any font from any provider assuming it supports requesting fonts in the same manner and does not require javascript.

This can be configured under the custom_fonts key.

  • urls: The urls supplied to you from your font provider (eg https://fonts.googleapis.com/css2?family=Merriweather). For best performance try to use as few urls as possible
  • preconnect: (optional) If your font provider serves the font files from another domain it can be useful to make a connection to that domain in advance. For example google load the font files from fonts.gstatic.com. This can be omitted if not required

If you want to customise this further you can find the include for custom fonts in _includes/site-custom-fonts.html.

Using includes

There are 2 main types of includes: ones designed for the site and ones that are designed as shortcodes. Here are a list of the shortcode includes:

button.html

A button that can link to a page of any kind.

Example usage: {% include button.html text="I'm a button" link="https://david.darn.es" %}

Available options:

  • text: The text of the button required
  • link: The link that the button goes to required
  • icon: The icon that is added to the end of the button text
  • color: The colour of the button

figure.html

An image with optional caption.

Example usage: {% include figure.html image="/uploads/feature-image.jpg" caption="Check out my photo" %}

Available options:

  • image: The image shown required
  • caption: A caption to explain the image
  • position: The position of the image; left, right or center
  • width & height: Optional width and height attributes of the containing image

icon.html

An icon.

Example usage: {% include icon.html id="twitter" %}

Available options:

  • id: The reference for the icon required
  • title: The accessible label for the icon
  • color: The desired colour of the icon
  • width & height: Width and height attributes for the icon, default is 16

nav-share.html

A set of buttons that share the current page to various social networks, which is controlled within the _config.yml file under the sharing_links keyword.

Example usage: {% include nav-share.html %}

Available options:

Twitter: "#1DA1F2"
facebook: "#3B5998"
Pinterest: "#BD081C"
LinkedIn: "#0077B5"
tumblr: "#36465D"
Reddit: "#FF4500"
HackerNews: "#ff6600"
DesignerNews: "#2D72D9"
Email: true

The first item is the name of the network (must be one of the ones stated above) and the second is the colour of the button. To remove a button remove the line of the same name.

video.html

A YouTube video.

Example usage: {% include video.html id="zrkcGL5H3MU" %}

Available options:

  • id: The YouTube ID for the video required

map.html

A Google map. See Google My Maps

Example usage: {% include map.html id="1UT-2Z-Vg_MG_TrS5X2p8SthsJhc" %}

Available options:

  • id: The map ID for the video required

site-form.html

Adds a contact form to the page. This can be used with Formspree or Netlify Forms depending on your setup.

Example usage: {% include site-form.html %}

Available options:

  • netlify_form=true: Set whether you would like to use Netlify Forms, otherwise the form will default to Formspree
  • name: Give the form a name, by default the form is called "Contact". The name will be reflected when form submissions come through in Netlify or in your email client. The name is also used in the label and input elements for accessibility

Use the email option in the /_config.yml to change to the desired email.

site-search.html

Adds a search form to the page.

Example usage: {% include site-search.html %}

This include has no options. This include will add a block of javascript to the page and javascript reference in order for the search field to work correctly.

site-before-start.html & site-before-end.html

Optional html includes for adding scripts, css, js or any embed code you wish to add to every page without the need to overwrite the entire default.html template.

Example usage: These are different to other includes as they are designed to be overwritten. If you create a site-before-start.html file in the _includes/ the contents of the file will be included immediately before the closing </head> tag. If you create a site-before-end.html file the contents of the file will be included immediately before the closing </body> tag.

Page layouts

As well as page, post, blog, there are a few alternative layouts that can be used on pages:

  • categories: Shows all posts grouped by category, with an index of categories in a left hand sidebar
  • search: Adds a search field to the page as well as a simplified version of the sidebar to allow more focus on the search results

Page and Post options

There are some more specific options you can apply when creating a page or a post:

  • aside: true: Adds a sidebar to the page or post, this is false by default and will not appear
  • comments: false: Turns off comments for that post
  • feature_image: "/uploads/feature-image.jpg": Adds a full width feature image at the top of the page
  • feature_text: "Example text": Adds text to the top of the page as a full width feature with solid colour; supports markdown. This can be used in conjunction with the feature_image option to create a feature image with text over it
  • indexing: false: Adds a noindex meta element to the <head> to stop crawler bots from indexing the page, used on the 404 page

Note: The Post List Page options are actually in the collection data within the _config.yml file.

Credits

  • alembic是sqlalchemy的作者开发的。用来做ORM模型与数据库的迁移与映射。alembic使用方式跟git有点了类似,表现在两个方面,第一个,alembic的所有命令都是以alembic开头;第二,alembic的迁移文件也是通过版本进行控制的。首先,通过pip install alembic进行安装。 使用alembic的步骤: 1. 定义好自己的模型。 2. 使用alembic创建

  • SqlAlchemy+sqlite3+Alembic 数据库迁移踩坑… NotImplementedError: No support for ALTER of constraints in SQLite dialect. Constraint must have a name 迁移需求: 1. 因为需求不断变化,所以数据库的字段甚至是table变化会比较大,自动迁移非常重要。 2. 数据库是分布

  • 第一步:创建项目目录 mkdir sqlalchemy_alembic 第二步:初始化数据库版本管理器 cd /xxx/xxx/sqlalchemy_alembic # init后的名称随意取 alembic init alembic 第三步:创建数据库目录databases,用于保存数据库模型 创建目录 cd /xxx/xxx/sqlalchemy_alembic mkdir databas

  • Alembic 是一款轻量型的数据库迁移工具,它与 SQLAlchemy 一起共同为 Python 提供数据库管理与迁移支持。 Alembic 的应用 Alembic 使用 SQLAlchemy 作为数据库引擎,为关系型数据提供创建、管理、更改和调用的管理脚本,协助开发和运维人员在系统上线后对数据库进行在线管理。 同任何 Python 扩展库一样,我们可以通过 pip 来快速的安装最新的稳定版 A

  • 初始化 alembic init alembic 查看历史head alembic history | head 变更数据库 Alembic 最重要的功能是自动完成数据库的迁移「变更」,所做的配置以及生成的脚本文件都是为数据的迁移做准备的,数据库的迁移主要用到 upgrade 和 downgrade 子命令。 数据看的变更主要用到以下命令: alembic upgrade head #将数据

  • 第一次删除了migrate文件夹 执行upgrade 发现没有生成表,然后versions文件夹中都是空的。 alembic init --template generic migrate # 使用generic目标,创建一个migrate文件夹,并初始化。 alembic revision --autogenerate -m "initdb" alembic revision --autogen

  • 简介 Alembic基于python实现,用于对数据库生成迁移脚本,实现自动化升级数据库(如加入新字段,修改字段等)或降级数据库(回退到之前的版本)。通常与sqlalchemy库一起使用。具体信息见官方文档 使用 安装alembic pip install alembic 在项目文件下进行初始化 alembic init alembic 初始化后项目文件夹下会新增alembic文件夹和alemb

  • 前言 通常我们会将我们的代码放入到某个VCS(版本控制系统)中,进行可追溯的版本管理。一个项目除了代码,通常还会有一个数据库,这个数据库可能会随着项目的演进发生变化,甚至需要可以回滚到过去的某个状态,于是一些工具将数据库的版本化也纳入了管理。 Alembic是Sqlalchemy的作者实现的一个数据库版本化管理工具,它可以对基于Sqlalchemy的Model与数据库之间的历史关系进行版本化的维护

  • alembic alembic是sqlalchemy的作者开发的,用来做OMR模型与数据库的迁移与映射, alembic的所有命令都是以alembic开头, alembic的迁移文件也是通过版本进行控制的, alembic安装 pip install alembic alembic使用 一、使用sqlalchemy创建好模型类 如创建一个models.py模块,然后在里面定义需要的模型类

  • 创建一个新的数据库迁移脚本 alembic revision –-autogenerate -m "initdb2" --head head (这段代码一定要手动输入) 下面的命令可以看到,migration/versions目录下,多出来一个55开头的py文件,555a49f2bef0就是版本号(77开头的是我创建的第一个版本)。 (venv) dorlolo@site: ls migratio

  • alembic笔记: 使用alembic的步骤: 定义好自己的模型。 使用alembic创建一个仓库:alembic init [仓库的名字,推荐使用alembic]。 修改配置文件: 在alembic.ini中,给sqlalchemy.url设置数据库的连接方式。这个连接方式跟sqlalchemy的方式一样的。 在alembic/env.py中的target_metadata设置模型的Base.

  • mysql迁移时出现错误:INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migrat 我也会经常出现这个错误 :(大部分是在迁移的时候 ;  那就更不用说生成迁移文件了) 我是发现了这个错误就像 状态码中的400一样;  是一个各种错 大部分是 错在我们的 模型类中; 如果说 我们已经生

  • 大家好,我是练习时长两年半的大数据练习生,喜欢数学,AI,大数据。 写博客是为了总结,分享,自娱自乐。希望写出的东西会对自己,对别人都有价值! 废话不多说,现在是个终身学习的时代,开始学习了!奥力给!干了兄弟们! 是时候展现真正的技术了: 本文是一篇翻译型学习笔记,原文如下链接。 https://www.pythoncentral.io/migrate-sqlalchemy-datab

  • 说实在的真不知道该怎么起这篇文章的标题。需求是这样的,数据库的设计与定义采用sqlalchemy ORM的方式进行定义,那么如果对需要对数据库结构进行修改呢,谁家的数据库设计也不会保证一步到位啊,这种模式下是不是我要先修改ORM定义,再用一个SQL修改数据库结构,因为当我的数据库已经在运行之后,总不能再Base.metadata.create_all()了吧。alembic就是为了解决这种问题而存

 相关资料
  • 问题内容: 我需要在Alembic升级期间更改数据。 我目前在第一个修订版中有一个“玩家”表: 我想介绍一个“团队”表。我创建了第二个修订版: 我希望第二次迁移也添加以下数据: 填充团队表: 根据players.team名称更新players.team_id: 如何在升级脚本中执行插入和更新? 问题答案: 您需要的是 数据迁移 ,而不是Alembic文档中最普遍的 模式迁移 。 该答案假设您使用声

  • 问题内容: 如何在第一次迁移中插入一些种子数据?如果迁移不是最佳选择,那么最佳实践是什么? 问题答案: Alembic作为其操作之一。该文档提供了以下示例(包含一些我已修复的问题): 还要注意,Alembic具有一个操作,就像SQLAlchemy中的普通功能:你可以运行所需的任何SQL,如文档示例所示: 请注意,用于创建update语句中使用的元数据的表是直接在架构中定义的。这似乎打破了DRY(不

  • 问题内容: 我很难让Alembic使用(Flask-SQLAlchemy)而不是自动生成从更改到类的候选迁移。 我已经进行了修改,以创建我的Flask应用,导入所有相关模型,初始化数据库,然后运行迁移: 这种方法适用于(例如,当重新创建用于单元测试的测试数据库时),但是在这种情况下,它似乎无法实现。自动生成的版本脚本始终具有空的升级和降级方法,例如, 我的更改包括重命名列,更改列定义等,而不仅仅是

  • 问题内容: 我正在使用Alembic处理Flask的迁移。理论上,应该基于数据库中的更改自动生成迁移。但是,Alembic仅使用上述命令即可生成空白迁移。 有一个与此问题非常相似的问题,即问题是没有导入正确的模型。但是,我已经从我的Flask应用程序导入了模型,如下所示: 以及中导入的数据库元数据env.py(“ start”是我的Flask应用程序主文件的名称): 运行,alembic revi

  • 我有一个项目,我在模型中使用SQLAlchemy,并尝试集成Alembic进行迁移。当我更改模型时,一切都按预期进行,Alembic看到模型已经更改- 但是当我没有改变模型中的任何东西并且我使用相同的命令时: 修订版给我“空”修订版文件,如下所示: 这个文件的目的是什么?当alembic revision--autogenerate看不到任何更改时,我可以阻止创建这个“空文件”吗?要比较使用Dja

  • 我对FASTAPI比较陌生,但决定与Postgres和Alembic建立一个项目。每次我使用自动迁移时,我都设法让迁移创建新版本,但由于某些原因,我没有从我的模型中获得任何更新,唉,它们保持空白。我有点迷失了方向。 主要的py公司 数据库py公司 我目前唯一的模型 env.py(alembic) 如果有人有任何想法,我将非常伟大。干杯!

  • 我正在尝试创建一个迁移,alembic正在运行,但是我得到了一个错误: 失败:无法继续使用--autogenerate选项;环境脚本/Users/paul/python/my_project/alembic/env。py不向上下文提供元数据对象或对象序列。 我不知道为什么我得到这个错误,因为我已经在env.py文件中设置了target_metadata,并将文件夹添加到路径中。我尝试从我的另一个项

  • 软件版本:alembic 1.0.5、SQLAlchemy 1.2.14、MySQL 5.7、Python 3.6.7 我试图使用alembic来保持MySQL数据库模式和Python ORM表示的一致性。 我看到的问题是,迁移总是有多余的外键删除和创建命令。autogenerate似乎认为有些东西是不同的,但实际上它们是相同的。 在重复调用命令时: ...将生成相同的拖放和创建命令。 stdou

相关阅读

相关文章

相关问答

相关文档