Closed Bridouz closed 6 years ago
The path parameter you pass to the olm
command is where it will look for the settings.py
so in your case it is looking at Blog/settings.py
when your settings file is actually just at settings.py
.
If you move the settings file into the Blog
directory and then run olm Blog/
then it should pick it up.
Thanks for being the guinea pig on this :P
Traceback (most recent call last):
File "/home/justin/Olm/bin/olm", line 11, in <module>
sys.exit(main())
File "/home/justin/Olm/lib/python3.6/site-packages/olm/__init__.py", line 35, in main
CONTEXT = load_context_from_file(settings_file_path, load_default_context(args.src))
File "/home/justin/Olm/lib/python3.6/site-packages/olm/context.py", line 75, in load_context_from_file
user_settings = getattr(py_mod, 'SETTINGS')
AttributeError: module 'settings' has no attribute 'SETTINGS'
:smile:
Haha, this is why there should be the quickstart command. And the documentation is not clear on this so I will fix that too.
The settings need to be in a dictionary called SETTINGS
. So in your case:
SETTINGS = {
BASE_FOLDER: "Blog",
SOURCE_FOLDER: "{{BASE_FOLDER}}/src",
STATIC_FOLDER: "{{BASE_FOLDER}}/theme/static",
TEMPLATES_FOLDER: "{{BASE_FOLDER}}/theme/temmplates",
CSS_FOLDER: "{{BASE_FOLDER}}/theme/static/css",
JS_FOLDER: "{{BASE_FOLDER}}/theme/static/js"
}
(Olm) Olm • olm Blog/
2018-04-10 22:14:07 [olm] Beginning static site generation
Traceback (most recent call last):
File "/home/justin/Olm/bin/olm", line 11, in <module>
sys.exit(main())
File "/home/justin/Olm/lib/python3.6/site-packages/olm/__init__.py", line 35, in main
CONTEXT = load_context_from_file(settings_file_path, load_default_context(args.src))
File "/home/justin/Olm/lib/python3.6/site-packages/olm/context.py", line 74, in load_context_from_file
py_mod = imp.load_source('settings', settings_file_path)
File "/home/justin/Olm/lib/python3.6/imp.py", line 172, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/justin/Olm/Blog/settings.py", line 2, in <module>
BASE_FOLDER: "Blog",
NameError: name 'BASE_FOLDER' is not defined
:wink:
Sorry, this is my error again.
Because it is a python dictionary the keys need to be strings too. So:
SETTINGS = {
"BASE_FOLDER": "Blog",
"SOURCE_FOLDER": "{{BASE_FOLDER}}/src",
"STATIC_FOLDER": "{{BASE_FOLDER}}/theme/static",
"TEMPLATES_FOLDER": "{{BASE_FOLDER}}/theme/temmplates",
"CSS_FOLDER": "{{BASE_FOLDER}}/theme/static/css",
"JS_FOLDER": "{{BASE_FOLDER}}/theme/static/js"
}
:+1:
Hi again,
Assuming I created a virtualenv for Olm and that I want to create a Blog inside
Blog
Blog directory looks like this :
settings.py