• Members 8 posts
    May 15, 2018, 11:04 a.m.

    Hello guys!!

    I am new to Misag. I am trying to run it locally and debug it in order to learn from it, the way of thinking, the design and Django also.

    In the github page you explain how to run it using Docker, well I tried to remote debug using docker and pyCharm but I don't think it is a big thing!

    Is is possible to run the project using virtualenv because it is better for debug I believe!

    Thank you all!!

  • May 15, 2018, 11:25 a.m.

    No idea how to configure remote debug in pycharm, but I'm sure it's possible if you know how it works.

    I just use the good old pudb when needed. If you start the misago container with docker-compose run --rm --service-ports misago bash it will run as a part of the compose setup and you start misago with manage.py. Then you have an interactive debugger opening in the terminal. Insert breakpoint in code with import pudb; pu.db. It's not fancy, but it works. Just remember to add pudb in requirements.txt and run build first.

    You can just make a virtualenv and install requirements if you want, but you will have to make your own devforum and provide your own postgres database. I'm sure you could just start postgres in the docker setup and connect to it using the port mapped to your host.

  • Members 8 posts
    May 15, 2018, 2:13 p.m.

    Thank you @einarf dould you please tell me the steps how to run it using virtualdev
    I tried to make a virtualenv and I installed the requirements but still not working:(

  • Members 8 posts
    May 15, 2018, 2:15 p.m.

    "C:\Program Files\JetBrains\PyCharm 2018.1.2\bin\runnerw.exe" C:\Users\Rodwan\Desktop\djangoBased\misago_ve\Scripts\python.exe C:/Users/Rodwan/Desktop/djangoBased/Misago-0.17.4/misago/project_template/manage.py runserver 0.0.0.0:8000
    Performing system checks...

    Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000002D10D5EF620>
    Traceback (most recent call last):
    File "C:\Users\Rodwan\Desktop\djangoBased\misago_ve\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
    fn(*args, kwargs)
    File "C:\Users\Rodwan\Desktop\djangoBased\misago_ve\lib\site-packages\django\core\management\commands\runserver.py", line 124, in inner_run
    self.check(display_num_errors=True)
    File "C:\Users\Rodwan\Desktop\djangoBased\misago_ve\lib\site-packages\django\core\management\base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
    File "C:\Users\Rodwan\Desktop\djangoBased\misago_ve\lib\site-packages\django\core\management\base.py", line 346, in _run_checks
    return checks.run_checks(
    kwargs)
    File "C:\Users\Rodwan\Desktop\djangoBased\misago_ve\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
    File "C:\Users\Rodwan\Desktop\djangoBased\misago_ve\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_config
    return check_resolver(resolver)
    File "C:\Users\Rodwan\Desktop\djangoBased\misago_ve\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolver
    return check_method()
    File "C:\Users\Rodwan\Desktop\djangoBased\misago_ve\lib\site-packages\django\urls\resolvers.py", line 254, in check
    for pattern in self.url_patterns:
    File "C:\Users\Rodwan\Desktop\djangoBased\misago_ve\lib\site-packages\django\utils\functional.py", line 35, in get
    res = instance.dict[self.name] = self.func(instance)
    File "C:\Users\Rodwan\Desktop\djangoBased\misago_ve\lib\site-packages\django\urls\resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
    File "C:\Users\Rodwan\Desktop\djangoBased\misago_ve\lib\site-packages\django\utils\functional.py", line 35, in get
    res = instance.dict[self.name] = self.func(instance)
    File "C:\Users\Rodwan\Desktop\djangoBased\misago_ve\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
    File "C:\Users\Rodwan\Desktop\python\lib\importlib__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    File "<frozen importlib._bootstrap>", line 978, in _gcd_import
    File "<frozen importlib._bootstrap>", line 961, in _find_and_load
    File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
    File "<frozen importlib._bootstrap>", line 978, in _gcd_import
    File "<frozen importlib._bootstrap>", line 961, in _find_and_load
    File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
    ModuleNotFoundError: No module named '{{ project_name }}'

  • May 15, 2018, 2:25 p.m.

    You are trying to run the project template. You need to create a forum. This is in the documentation.

  • May 15, 2018, 2:52 p.m.
  • Members 8 posts
    May 15, 2018, 2:57 p.m.

    @einarf I will try your solution, thank you :)))
    @rafalp I lost many hours trying to debug using docker and pycharm, it did not work for me I am trying to run it using viertualenv.

  • Members 8 posts
    May 15, 2018, 3:01 p.m.

    @einraf by installing misago as a dependency I will be able to debug the source code ?!

  • Members 8 posts
    May 15, 2018, 4:29 p.m.

    Following the documentation I am getting error after making migrations, it looks like it is migrating some files but not all!!

    Operations to perform:
    Apply all migrations: admin, auth, contenttypes, misago_acl, misago_categories, misago_conf, misago_core, misago_legal, misago_readtracker, misago_threads, misago_users, sessions
    Running migrations: Applying misago_threads.0005_index_search_document...Traceback (most recent call last):
    File "manage.py", line 23, in <module>
    execute_from_command_line(sys.argv)
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/core/management/init.py", line 364, in execute_from_command_line
    utility.execute()
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/core/management/init.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, cmd_options)
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args,
    options)
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/contrib/postgres/operations.py", line 17, in database_forwards
    schema_editor.execute("CREATE EXTENSION IF NOT EXISTS %s" % schema_editor.quote_name(self.name))
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 136, in execute
    cursor.execute(sql, params)
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in exit
    six.reraise(dj_exc_type, dj_exc_value, traceback)
    File "/home/rodwandeyab/Desktop/misago_ve/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
    django.db.utils.ProgrammingError: permission denied to create extension "btree_gin"
    HINT: Must be superuser to create this extension.

  • Members 8 posts
    May 15, 2018, 5:09 p.m.

    I could finally run the project in debug mode using pyCharm and virtualenv
    I followed the documentation and I can see the source code of misago in the dependencies of the project (the lib folder of the virtualenv) where I can put breakpoints and debug!
    Thank you guys! :)))

  • edit

    Thread title has been changed from How to run Misag for debug with pyCharm..