I’ll be documenting how I installed Manjaro in this article for future reference. We will also be starting from booting into the bootable USB, check another guide on how to make that if you haven’t done that yet. From the image above, running down the list:
— Select your timezone
— Keyboard, Language (I default to US)
— Driver: free if intel integrated, not free if nvidia
Enter the Boot: Manjaro
Getting this error while trying to deploy a Django app? Check the logs with this command:
journalctl --unit=gunicorn | tail -n 100
With this command, you can see gunicorn trying to startup your Django app more clearly compared to sudo service gunicorn status
.
If your systemd socket/service settings file ( /etc/systemd/system/*
) contains the setting EnvironmentFile
, make sure to check the format of your env file. It cannot be the bash script format like this:
export MY_KEY=123
export MY_OTHER_KEY=aaa
MY_KEY=123
MY_OTHER_KEY=aaauld
If your gunicorn is active and running from sudo service gunicorn status
, but your website still doesn’t show up. …
This article will go through how I got subdomains to work on Django 3 with Certbot for https. It was a little finicky to get working, since I couldn’t find much info on some specific errors I was running into. Maybe I’m just not a high level search engine ninja, but I figured it out myself. My server was using nginx, but I think it shouldn’t matter if you use apache or something else. …
Something very useful I’ve found while using Django is writing custom Django-admin commands for your manage.py. Essentially this is just appending arguments to the CLI of manage.py. You might wonder why can’t you just make your own script in like a folder called project_name/utils/
, but you would need to jump through a lot of hoops to use the resources in your Django app in order to do so. If you want to just take a look at the docs instead, you can find it here.
Here’s a pretty useful example: say you wanted to update the blogs on your site that comes from Medium. We can write a custom manage.py command and use a crontab on the server to run it at any interval you want it to be. …
This was a problem I ran into recently, and here’s a simple solution to it. The Django doc’s example handles this problem by making 2 admin sites, but I wanted to handle 2 databases on1 admin dashboard.
In project_name/app_name/admin.py
we can register our objects to be on the localhost:8000/admin interface. All we need to change here is add a class MultiDBModdelAdmin
from the docs, and also a class that specifies the name of our database we want for the models in this app:
# admin.py of one of your apps
from django.contrib import admin
from .models import Article, Authorclass MultiDBModelAdmin(admin.ModelAdmin):
def save_model(self, request, obj, form, change):
# Tell Django to save objects to the 'other' database.
obj.save(using=self.using)
def delete_model(self, request, obj):
# Tell Django to delete objects from the 'other' database
obj.delete(using=self.using)
def get_queryset(self, request):
# Tell Django to look for objects on the 'other' database.
return super().get_queryset(request).using(self.using)
def formfield_for_foreignkey(self, db_field, request, **kwargs):
# Tell Django to populate ForeignKey widgets using a query
# on the 'other' database.
return super().formfield_for_foreignkey(db_field, request, using=self.using, **kwargs)
def formfield_for_manytomany(self, db_field, request, **kwargs):
# Tell Django to populate ManyToMany widgets using a query
# on the 'other' database.
return super().formfield_for_manytomany(db_field, request, using=self.using, …
This article is mainly for beginners at webscraping, and should help with thinking about how to scrape something specific off a website with the example below. The best way to learn methods on grabbing specific HTML tags is to find a website you frequently go to and try to automate something with the text you can grab from that site. Normal advice but; read the official docs when trying to pinpoint a HTML tag, then google carefully…
I typically just have test files for specific HTML tag targets that are hard to grab, and a main file with the rough draft of the entire scraper. Once the rough draft is done and the scrapes are outputting the correct format I want; start to abstract the code more. …
I have been using pass
for about over a month now, and I think it’s a great terminal password manager. It uses gpg to encrypt your passwords into physical files in an organized folder system. And yes, the images below are all on WSL (Windows Subsystem for Linux) on Windows. It is a simple process to use Linux on Windows; Type in powershell in your start menu, run as admin, and run this command: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
After it restarts your pc, just go to the Microsoft Store and install Ubuntu (or a listed distro of your choice). …
I recently had my first experience installing Linux on my Windows laptop, and it was a lot more simple than I thought it would be. As it is a very simple process, I think anyone should be able to do this following a few steps. The process is pretty much shrinking your storage space to create “free space”, which will be used to create a partition for your Linux distro to be installed in. After creating the empty partition, you go into your Windows BIOS and boot up the USB drive that contains the Linux distro installer. …
float _pow_recursion(float x, float y)
{
if (y == 0)
return (1);
if (y < 0)
return (_pow_recursion(x, y + 1) / x); printf("Current x, y: %f, %f\n", x, y); return (_pow_recursion(x, y - 1) * x);
}
Recursion can be a tricky concept to wrap your head around, but think of it as a stack of blocks that pop down to return it’s result. The program above will be our recursive example for learning recursion. Take note of the exit condition, which is if (y == 0) return 1;
. This means that when y
becomes 0, the program will exit and give you back the result of it’s recursion. The next piece of code to look at it is return (_pow_recursion(x, y - 1) * x);
, this is how our program will recursively call itself until it hits it’s exit condition to pop down to give our result. …
Going to a website goes through several steps, starting from typing the URL. When you hit enter after typing in “holbertonschool.com”, your browser looks up the domain’s IP with its domain name via the DNS (Domain Name System). Once your browser finds the domain name and it’s IP, it sends a HTTP request to the server via TCP/IP. Your browser then should get a HTTP response back from the server, and if it comes back as 200 (if the page loads), then all the data from that webpage you requested should be displayed onto your browser.
The TCP/IP model has 4…
About