Search code examples
weblate

How to create project by api, cli or management commands


I need programatically create new empty (or not) project. How can i do that? Then i use import-json to create components.

The documentation has import-project command, but

< project > names an existing project, into which the components should be imported.


Solution

  • I can do that with weblate shell or ./manage.py shell

    from weblate.trans.models import Project
    project = Project.objects.create(
                name='Test',
                slug='test',
                web='https://weblate.org/'
    )
    project.save()
    

    Also you can exec script from file

    weblate shell < create_project.py