GithubHelp home page GithubHelp logo

codexrunner's Introduction

codexrunner

Django app for running Python code interview

Settings

To configure it, it is enough to specify the data for connecting to django_rq in local_settings:

RQ_QUEUES = {
    'default': {
        'HOST': 'localhost',
        'PORT': 6379,
        'DB': 0,
        'PASSWORD': '',
        'DEFAULT_TIMEOUT': 360,
    },
    ...
}

You can also set the necessary settings of the package itself (example of default settings):

DEFAULT_SETTINGS = {
    'IMAGE': {
        'NAME': 'codexrunner_image',
        'DOCKERFILE_PATH': absolute_path + '/runner/',
        'RUNNER_PATH': absolute_path + '/runner/image/cli_runner.py',
        'CONTAINER_WORKDIR': '/cli/',
        'PYPROJECT_TOML_PATH': absolute_path + '/runner/image/pyproject.toml',
    },
    'STAGES': [
        ('flakehell', 'python3 -m flakehell lint answer.py --format=gitlab --output-file flakehell.json'),
        ('bandit', 'python3 -m bandit -r answer.py -q -f json -o bandit.json --ignore-nosec'),
        (
            'pytest',
            'python3 -m pytest --json-report --json-report-file=pytest.json -v tests.py -q --disable-warnings -s',
        ),
    ],
    'RQ': {
        'QUEUE_NAME': 'default',
    }
}

After that, you need to build the Docker image using the command:

python3 manage.py codexrunner_build_image

And add a list of addresses to urls:

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('codexrunner.urls')),
]

And finally perform migrations.

Example

Example

codexrunner's People

Contributors

froozzy avatar

Stargazers

Herman Schechkin avatar  avatar

Watchers

 avatar

codexrunner's Issues

Error history

Traceback:

File "/home/test18/.pyenv/versions/3.7.7/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/home/test18/.pyenv/versions/3.7.7/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/home/test18/.pyenv/versions/3.7.7/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/test18/.pyenv/versions/3.7.7/lib/python3.7/site-packages/sentry_sdk/integrations/django/views.py" in sentry_wrapped_callback
  67.             return callback(request, *args, **kwargs)

File "/home/test18/.pyenv/versions/3.7.7/lib/python3.7/site-packages/django/views/decorators/http.py" in inner
  40.             return func(request, *args, **kwargs)

File "/home/test18/.pyenv/versions/3.7.7/lib/python3.7/site-packages/codexrunner/views.py" in wrapper
  38.             return function(*args, **kwargs)

File "/home/test18/.pyenv/versions/3.7.7/lib/python3.7/site-packages/codexrunner/views.py" in get_code_result
  153.         request.codexrunner_user.completed_tasks.add(user_run_task)

File "/home/test18/.pyenv/versions/3.7.7/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py" in add
  938.                     through_defaults=through_defaults,

File "/home/test18/.pyenv/versions/3.7.7/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py" in _add_items
  1055.                             (self.model._meta.object_name, obj)

Exception Type: TypeError at /interview/codexrunner/api/v1/code/result/
Exception Value: 'Task' instance expected, got <UserRunTask: c91ffd02-2faf-4b7f-9692-c705acf7e39f>
Request information:
USER: bondarenko

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.