An online judge built with Python and the Django framework to test cases against your solution. A better version of this is to be implemented in DomeCode. Check out the sponsor links and help fund DomeCode.
I'm trying to build an online judge to allow users of DomeCode to practice coding problems online. DomeCode is a project of mine in the making that allows people to learn code by practicing,participating in DomeCode's forum and using the resources compiled from all over the internet and woven together to create a one-stop experience for programmers.
The autograder for DomeCode is also being built on top of this with more ramifications and a few more features for the first release. But in actuality, this is the underlying piece of code in the most minimalistic way.
To put it simply, adding a compiler like Cloud9 IDE or Sphere online judge is gonna cost me some bucks so initially I plan on building an in-house solution to allow users to practice coding problems like they did on Google Kickstart before 2019 or the way Coursera's autograder does. I hope this works out since the concept is sound as per my understanding.
- Add “coder” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
...
'coder',
]
Include the polls URLconf in your project urls.py like this:
path('coder/', include('coder.urls')),
Run python manage.py migrate to create the polls models.
-
Run the migrations!
-
Run the server. And get on your
localhost:8000/admin
-
You will notice the coder app and it's models quite like this :
-
Create a new question. I included the RichTextEditor too so that should make it easier to include photos, symbols, charts and more.
I just submitted the correct solution and as you can see, the autograder evaluated it as a correct answer.
- Yes, I know. I need to add a checkmark next to the question if it's evaluated correct but this is just to show that the autograder works and you can head back to the homepage of the website and submit your answer to the question! The possibilities tread as far as your imagination on how to use this. Modify this code to suit your purpose, it's MIT Licensing so have at it!
Most importantly though, if you liked using this, STAR ⭐ and FORK 🍴 this repository. That would make me happier and I would feel motivated to add new exciting features to this.
If you actually used this, you might be wondering how does the autograder make the process so blazingly fast in comparision to other autograders that might take a while ( ~10-15 secs whereas this app does it within ~2-3 seconds ), the reason lies within the fact that it never actually reads from the disk while evaluating the user's solution, it directly reads from the memory and does not overwhelm the system either since text files are generally smaller.
If this project actually gets a decent number of stars and forks, I will be implementing a few more core features to this including but not limited to :
-
Search functionality 🔍 -
Displaying whether the answer is correct in Question's submission panel. ✅
-
Displaying whether the question attempted by the user is correct in the Question List View. ✅ -
Adding an actual compiler ( resource-heavy so well yeah it's expensive when run on the cloud ) 💸
-
Better admin interface 🌟
-
Rich text editing for coding problems to include pictures and more!✨
Since I've already started to build this, I'm probably gonna learn to build a cloud based compiler as well and add it on this existing version of Online Judge/autograder to make it a full-fledged Online Judge to the likes of Sphere Online Judge.
I intend to keep the source code absolutely open source forever for people to use and instead of paying services like Cloud9 IDE or Sphere Online Judge, this would allow users to implement this in the form a PyPi package ( will ship it soon ) and use it for their own applications and host it on AWS/GCP/Digital Ocean for slightly cheaper than you might with a pre built online judge to be embedded in your application.
This open source project is here to stay and be maintained so I would urge you to consider supporting this project by sponsoring it! Links included on the Github repo info panel.
Also checkout one of the other projects, Geddit 🦄 having base structural code for some of the features of DomeCode.
I also want to thank the Django Developer Community all over the internet for being a good help when I got stuck.