... | ... | @@ -8,6 +8,10 @@ All the lektor-based websites work the same, although they have different reposi |
|
|
* [GetTor webpage](https://gettor.torproject.org/): `https://gitlab.torproject.org/tpo/anti-censorship/gettor-project/gettor-web.git`
|
|
|
* [Donation page](https://donate.torproject.org/): `https://gitlab.torproject.org/tpo/web/donate-static.git`
|
|
|
|
|
|
## Setting up a development environment
|
|
|
|
|
|
The process to set up a development environment for one of our sites is a bit complicated, but once you set it up, you won't need to do it again!
|
|
|
|
|
|
### **1. Install Python 3.8**
|
|
|
|
|
|
Download and install [Python 3.8][]. If you're on linux, your package manager might provide a `python3.8` package.
|
... | ... | @@ -102,6 +106,8 @@ grep -q 'LEKTOR_BUILD_FLAGS: *scss' .gitlab-ci.yml && echo 'this site uses the l |
|
|
|
|
|
Some websites need additional `-f` flags. You should check the README file of the site to find out what plugins it needs. If the site doesn't have a README file, you can also check the `.gitlab-ci.yml` file, and look for the line starting with `LEKTOR_BUILD_FLAGS:`
|
|
|
|
|
|
Check out the [developing on the website](./How-to-develop-on-the-website) page for more detailed information.
|
|
|
|
|
|
> **Tip**: When you build a site that uses more than one flag, remember to include `-f` before each one, like this: `lektor build -f flag1 -f flag2`
|
|
|
|
|
|
#### Changing the content
|
... | ... | @@ -121,26 +127,34 @@ Note: It will not work on Tor Browser. :) |
|
|
|
|
|
> **Tip**: To save some time while you build in local, you can edit the [configs/i18n.ini](https://gitweb.torproject.org/project/web/tpo.git/tree/configs/i18n.ini) file and take some languages out of the 'translations' option.
|
|
|
|
|
|
# Most common lektor errors
|
|
|
## Most common lektor errors
|
|
|
|
|
|
##### FileNotFoundError:
|
|
|
FileNotFoundError: [Errno 2] No such file or directory: '/content/**some filename**/contents.lr'
|
|
|
### FileNotFoundError:
|
|
|
|
|
|
```
|
|
|
FileNotFoundError: [Errno 2] No such file or directory: '/content/**some filename**/contents.lr'
|
|
|
```
|
|
|
|
|
|
This happens when a source file `contents.lr` has been deleted in the repository, but their associated language files are still there. So, when trying to update the language files, lektor fails because the source file is not there. Delete the folder with the translations and build again:
|
|
|
|
|
|
rm -r '/content/**some filename**/'
|
|
|
```
|
|
|
rm -r '/content/**some filename**/'
|
|
|
```
|
|
|
|
|
|
##### Update lego
|
|
|
### Update lego
|
|
|
|
|
|
Example:
|
|
|
/training/code-of-conduct/index.html (jinja2.exceptions.UndefinedError: 'render_text' is undefined)
|
|
|
```
|
|
|
/training/code-of-conduct/index.html (jinja2.exceptions.UndefinedError: 'render_text' is undefined)
|
|
|
```
|
|
|
|
|
|
Can be fixed with `git submodule update --init --recursive`
|
|
|
|
|
|
##### SyntaxError
|
|
|
### SyntaxError
|
|
|
|
|
|
except IOError, e: SyntaxError: invalid syntax
|
|
|
|
|
|
This can be the python version. Try it with Python 2.7 to 3.7
|
|
|
This can be the python version. Make sure you're using Python 3.8
|
|
|
|
|
|
* If you encounter the error: `from urllib import requestImportError: cannot import name request`, you can fix it by going to `~tpo/lego/packages/xml-to-html/lektor_xml_to_html.py` and changing the line `from urllib import request` to `from urllib3 import request`. You may also have to do the same change for the `~tpo/lego/packages/txt-to-html/lektor_txt_to_html.py` file.
|
|
|
|
... | ... | @@ -150,26 +164,33 @@ reload(sys) |
|
|
sys.setdefaultencoding('utf8')
|
|
|
```
|
|
|
|
|
|
##### 'i18n' already exists
|
|
|
### 'i18n' already exists
|
|
|
|
|
|
If `git clone https://gitlab.torproject.org/tpo/translation.git i18n` fails with:
|
|
|
|
|
|
fatal: destination path 'i18n' already exists and is not an empty directory.
|
|
|
```
|
|
|
fatal: destination path 'i18n' already exists and is not an empty directory.
|
|
|
```
|
|
|
|
|
|
This happens if you tried to build lektor before downloading the translations. You need to remove that directory and try cloning again:
|
|
|
|
|
|
rm -r 'i18n'
|
|
|
git clone https://gitlab.torproject.org/tpo/translation.git i18n
|
|
|
```
|
|
|
rm -r 'i18n'
|
|
|
git clone https://gitlab.torproject.org/tpo/translation.git i18n
|
|
|
```
|
|
|
|
|
|
##### babel.cfg not found
|
|
|
### babel.cfg not found
|
|
|
|
|
|
If when building the website you get the error:
|
|
|
|
|
|
"FileNotFoundError: [Errno 2] No such file or directory: 'babel.cfg'"
|
|
|
```
|
|
|
"FileNotFoundError: [Errno 2] No such file or directory: 'babel.cfg'"
|
|
|
```
|
|
|
|
|
|
You are not on the root directory for lektor. Go to the root directory and try again.
|
|
|
|
|
|
##### Weird characters between lines on the website
|
|
|
### Weird characters between lines on the website
|
|
|
|
|
|
Sometimes the paragraphs of the website will be mixed with phrases like: `Project-Id-Version: PACKAGE VERSION Report-Msgid-Bugs-To: PO-Revision-Date: 2018-11-14 12:31+0000 Last-Translator: ...`
|
|
|
|
|
|
![scruff-on-lektor-local](uploads/0715ecc33a5bf18964127733a812ba6c/scruff-on-lektor-local.png)
|
... | ... | @@ -179,7 +200,7 @@ You need to run `lektor build` more times for this text to disappear. |
|
|
|
|
|
If the unwanted text is still present after building the site multiple times, you might be using Python 3.9 or higher. The lektor-i18n-plugin requires Python 3.8 to work.
|
|
|
|
|
|
##### Setuptools error
|
|
|
### Setuptools error
|
|
|
|
|
|
If when building the website you get the error:
|
|
|
|
... | ... | @@ -202,14 +223,6 @@ You will need to upgrade your `pip` and run `lektor server` again: |
|
|
|
|
|
pip3 install --upgrade pip
|
|
|
|
|
|
##### Changes to content or templates not showing up after building
|
|
|
### Changes to content or templates not showing up after building
|
|
|
|
|
|
If you build a site, make changes, and build the site again, Lektor might not rebuild the file. If you're wondering why your changes aren't showing up, try running `lektor clean --yes` and re-building. This forces lektor to build from scratch. It can take a while, but it might fix your problem. THe translation files will already be in place, so you won't need to build from scratch multiple times. |
|
|
|
|
|
### DONE
|
|
|
|
|
|
Great! You are set! Now you can start [developing on the website](./How-to-develop-on-the-website), or also [write content](./Writing-the-content)
|
|
|
|
|
|
------------------------
|
|
|
|
|
|
To update this wiki, please do a PR to https://gitlab.torproject.org/torproject/web/wiki |