How to configure PyCharm for remote OpenStack Horizon Development?

I'm new to Python and currently evaluating PyCharm. An upcoming project requires to do some development on OpenStack's dashboard. My problem is that I cannot get PyCharm to successfully run Horizon (i.e. OpenStack Dashboard) on the remote machine (it's DevStack on a vagrant VM).

So far I managed to run a generic Django project on a remote machine by using vagrant successfully. I also could set up an OpenStack development environment as outlined with http://docs.openstack.org/developer/horizon/quickstart.html successfully.

However the problem starts when I try to combine both. In my use case, I would like to remote develop the Horizon Dashboard by using the DevStack environment. If you do this outside of PyCharm, you would run it with command

Code
/opt/stack/horizon/tools/with_venv.sh ./manage.py runserver 0.0.0.0:8080


The problem is that I could not find any option within PyCharm's "Run/Debug Configuration" menu which would allow me to include the path "/opt/stack/horizon/tools/with_venv.sh" as shown above. As a result I get the below when I run the application within PyCharm.

Code
ssh://vagrant@127.0.0.1:2222/usr/bin/python -u /home/vagrant/horizon/manage.py runserver 0.0.0.0:8877
Traceback (most recent call last):
  File "/home/vagrant/horizon/manage.py", line 23, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 261, in fetch_command
    commands = get_commands()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 107, in get_commands
    apps = settings.INSTALLED_APPS
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 54, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 49, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__
    % (self.SETTINGS_MODULE, e)
ImportError: Could not import settings 'openstack_dashboard.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named xstatic.main

Process finished with exit code 1


Any pointers are very much appreciated!

Please sign in to leave a comment.