Computer Science

Computer Science · June 12, 2026
1. Do I need to rotate journalctl? I often see logs by journalctl -u myproject -f. By the way, is the journal rotated? I think I need to rotate it because it will pile up in the server. Yes. If you're viewing logs with: journalctl -u myproject -f those logs are managed by systemd-journald, and journald has its own log rotation and cleanup mechanism. You do not use logrotate for journalctl logs. Check current disk usage journalctl --disk-usage Example: Archived and active journals take up 256.0M...
Computer Science · May 20, 2026
1. Why does it work without importing the function? I don't understand the following: signer = TimestampSigner() token = signer.sign(str(user.id)) payment_url = (f"{settings.DOMAIN}" f"/accounts/billing-recover/{token}/") remaining_days = (user.data_deletion_scheduled_at - timezone.now()).days # maybe 30 subject = "Account suspended – action required to restore access" context = {"user": user, "payment_url": payment_url, "remaining_days": remaining_days,} message =...
Computer Science · May 19, 2026
1. A problem When I tried to upload a file of more than 10MB, it was supposed to display some message. But instead, the following page was shown: 413 Request Entity Too Large nginx/1.24.0 (Ubuntu) Why? How can I display my own message? The following is part of models.py: (Code omitted) The following is part of forms.py: (Code omitted) And a view: (Code omitted) This happens because the upload is being rejected by Nginx before Django even receives the file. Your validator: validate_file_size()...
Computer Science · May 12, 2026
1. Problem What is the difference between these two lines? I first wrote the first one, then I changed it to the second by commenting the first one. But I don't remember why I did so. Can you figure out why I did? #documents = ClientDocument.objects.all() documents = ClientDocument.objects.select_related("client__clientprofile__admin", "uploader").order_by("-uploaded_at") Yes. The second line is an optimization to avoid excessive database queries. You probably changed it after encountering slow...
Computer Science · April 24, 2026
1. How to broaden the width of a table I have a summary page of all the admins that can be seen by the superadmin. I am using bootstrap 5.3.3. I think I am going to add two columns to the summary table, but I need more space. In fact, there is some space on the both sides of the table, it is about 2 centimeters each. How can I broaden the width of the table? Here is the header and some other lines of superadmin_summary.html: (HTML omitted) You’re seeing that extra space because of this line:...
Computer Science · April 14, 2026
1. Introduction This article is part of Production March 08, 2026 Production: Next move (S3) "Second: Replace FileResponse with S3 Presigned URLs." I am going to use presigned URLs for image file preview. But before doing it, I will create a system that create a small png file from the original image file when uploading it. 2. Overwiew How about creating a preview file when a document is uploaded? Does this cost something? For example, when uploading 10MB file, the system automatically creates...
Computer Science · April 04, 2026
1. python manage.py dbshell I want to check the database. Will "python manage.py dbshell" work? I never used postgreSQL's dbshell. Can you explain how to use dbshell in plain words? Yes — python manage.py dbshell will work, and it’s a good way to quickly inspect your PostgreSQL database. 👍 I'll explain it in plain, step-by-step terms. What dbshell does It opens the PostgreSQL command line connected to your Django database. Think of it like: Django → opens → psql → already connected...
Computer Science · March 28, 2026
1. signals.py I'm just wondering what is going on about the following code. In settings.py, INSTALLED_APPS = [ ..., "client_portal.apps.ClientPortalConfig",] In client_portal/apps.py, class ClientPortalConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" name = "client_portal" def ready(self): import client_portal.signals I think this is something about "signals". But I forgot what "signals" here are. Can you explain why the code is so? You're right — this pattern is...
Computer Science · March 05, 2026
1. A Problem This is part of AdminSignupView(): # 🆕 First-time signup else: form = AdminSignupForm(request.POST) if not form.is_valid(): print("form.is_valid() is not True") return render(request, "accounts/signup.html", {"form": form}) print("Creating new user") # debug user = form.save(commit=False) user.is_active = False user.has_paid = False user.signup_completed = False user.save() With this, if form.is_valid() is not true, the signup form is displayed silently again. I tried to signup...
Computer Science · March 03, 2026
1. Is it okay to use Youtube? I created a database software. Is it okay to use youtube to let people know about my software? Or is it prohibit to advertize commercial products? It is absolutely okay and common practice to use YouTube to promote your own software. YouTube's Terms of Service explicitly allow you to use your content to promote your "business or artistic enterprise". However, there are specific rules you must follow to ensure your account remains in good standing: 1. Transparency...

Show more