Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,738 members, 7,817,031 topics. Date: Saturday, 04 May 2024 at 12:01 AM

ColeDrain's Posts

Nairaland Forum / ColeDrain's Profile / ColeDrain's Posts

(1) (2) (3) (4) (5) (6) (7) (of 7 pages)

Programming / How I Ran Django On My Android Phone by ColeDrain(m): 10:02am On Sep 04, 2020
How I ran Django on my android phone

Yeah, it seems weird coding with your phone, but right now I don't have an option, so if you are like me or you just fancy the idea, you can also do this. This is not an introduction to Django tutorial but how to work on Django with your android.


First we need something like a Linux terminal(or CLI) for android. Lucky for us, there is a terminal emulator on Google play store called Termux, so head to playstore and install it.
Link:termux


Okay, so you have installed it, what next?
So basically you can do whatever you could do on a Linux terminal now with this app(create directories, move files, change directory). This is how Termux looks like.



So let's roll in. Enter this command to view where Termux saves your files.
$ pwd

So that's where Termux saves your files, but the problem is you can't access that folder because of safety issues.

So to be able to access your files..
run this command
$ termux-setup-storage

And allow permission to storage in the popup shown.

Now change directory to your internal shared storage by running this command.
$ cd /sdcard
N:B this command doesn't point to your external SD card but your internal SD card(storage).


Then let's create a folder to store our Django projects, let's call it django_projects.
So run this command.
$ mkdir django_projects
$ cd django_projects


Now let's install python
To install python, run this
$ pkg install python
To check if python is installed, run the python command to enter python console.
$ python

N:B Use ctrl + z to exit the terminal. Termux app comes with a ctrl key.


Let's create a project called mysite
So still in that django_projects, run this commands.
$ mkdir mysite
$ cd mysite

We need a virtual environment to avoid dependencies clash. So let's install a virtual environment, run this command.
$ pip install virtualenv

After installing it, run
$ virtualenv venv
to create a virtual environment.. Then activate the virtual environment by running (note the full stop)
$ . venv/bin/activate


Now we have a virtual environment, let's install Django. run..
$ pip install Django

Okay, so Django is installed in our venv, let's create a Django project. run..
$ django-admin startproject hello .
(note the full stop)

Then let's run migrations..
$ python manage.py migrate

You can then run the server..
$ python manage.py runserver

voilà, go to your phone browser and open
localhost and you should see this.


You can always view your files by going to your file manager and searching for django_projects folder.

Feel free to indulge me, if any issues.

3 Likes

Programming / Re: Learn How To Create Websites With Python(Django Web Framework) by ColeDrain(m): 2:56pm On Sep 03, 2020
BoleAndFish:
How do I do this?
What text editor are you using?

Just create a new file from your text editor and save it in the polls folder.
Programming / Re: Learn How To Create Websites With Python(Django Web Framework) by ColeDrain(m): 12:31pm On Aug 22, 2020
BoleAndFish:
Hi ColeDrain, I just installed django through your tutorial and it was successful. Though I got a message when I ran mysite in the command prompt saying

You have 18 unapllied migration(s). your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run 'python manage.py migrate' to apply them.

Should I run it?

Yeah, that will solve the issue.
Programming / Re: Django Or Node? by ColeDrain(m): 6:35pm On Aug 21, 2020
BoleAndFish:
From what you're saying, you'll advice a newbie (that's looking at job opportunities) to go for c# rather than python django?

ColeDrain what do you have to say here?

Hey man.
Programming languages, web frameworks or engines are just tools, all have their strengths and weaknesses, there's no 'perfect guy'.

Most people use express.js with node.js for backend specific purpose.

I have used Django and it's pretty okay so let me talk about it, it's scalable, and you can build web applications very fast with it. The fun thing about Django is that it is a python web framework, and python arguably is one of the easiest programming languages to pick, the easiness doesn't mean python isn't powerful, it is very powerful, I think Instagram and YouTube use python.

I find JS as a convoluted language, it's good, it's fast, but the complexities it brings some times, sure you can get over them.

So I would recommend Django for a beginner.
If you already have knowledge of JS, you can use express.js with node.js.
If it's about getting a job: PHP, java are more popular in Nigeria market (I think), stats in Nigeria are very scarce.

Don't only be seeking job in Nigeria sha, look outside too sha.

P:S Some may mention JS is faster than python, but with the kind of servers and clients we have speed doesn't matter so much.

3 Likes

Programming / Re: Learn How To Create Websites With Python(Django Web Framework) by ColeDrain(m): 4:33pm On Aug 19, 2020
pixey:
@coledrain Keep up the good work for django beginners ! You are really amazing.

Thanks man.
Programming / Re: Learn How To Create Websites With Python(Django Web Framework) by ColeDrain(m): 4:33pm On Aug 19, 2020
BoleAndFish:
Good day guys. Pls I need suggestions on good videos or book on django to download.

Please, help.

Books:
1. Django 3 by Example
2. Two Scoops of Django

Videos:
Check these guys on YouTube, they have tons of Django videos.
1. Just Django
2. Corey Shafer
3. Dennis Ivy

2 Likes

Programming / Re: Learn How To Create Websites With Python(Django Web Framework) by ColeDrain(m): 9:26am On Aug 19, 2020
Men. It's so hard to do a tutorial on Nairaland.
Programming / Re: Learn How To Create Websites With Python(Django Web Framework) by ColeDrain(m): 12:25am On Aug 04, 2020
KlausMichaelson:
And that was how the story ended??
sad

Hey man. I have been caught up in a lot. We will continue this month... Sorry guys..

1 Like

Webmasters / How To Create your buhari HTML tag in 2 mins. by ColeDrain(m): 5:52pm On Jun 18, 2020
So I wanna create a HTML tag named buhari with my own preferred properties.

Just like we have h1, h2, p tags.
Something like this <buhari></buhari>

To have an idea of how interesting this is. The h1 tag for example comes with a bolder font weight and 30px font size, anywhere the browser sees h1 it applies those properties, the same with our buhari tag.


1. Open your stylesheet(CSS file)
and create a selector using buhari, then add your preferred properties
N:B You can use internal CSS

buhari{
color: blue;
font-size: 30px;
text-decoration: underline;
}


So any text within the buhari tag will have a blue text color, a font size of 30px and will be underlined.

2. Go to your HTML file, link it with your CSS file.
Then use the buhari tag.
<buhari>I work like any other HTML tag.</buhari>
<buhari>This is a buhari tag.</buhari>



Voila! It should give you the last image below. Simple as abc.

N:B This is not advised as it is bad practice. Just for fun tho...
I am crazy right? grin

1 Like

Science/Technology / Why Gecko's Tail Dances? by ColeDrain(m): 12:12pm On Jun 13, 2020
Okay, let's say I was curious about this.

Why do Gecko's tail dance and how is it possible?

It is amazing how only a tail can flip, jump and dance. The gecko's tail is connected to it's spinal cord, but once any of the three below occurs, it detaches it. Just a small pinch in the right place is all it takes for the gecko to drop its tail.

First there are many reasons why a gecko's tail may drop:
1. It is being attacked by a predator
When a gecko senses that it is being attacked, it drops its tail to distract the predator, as the predator is being distracted by the tail, the gecko escapes. Some times even the tail escapes, then the gecko comes back for it to eat.
2. The tail got stuck
This may happen if the gecko gets stuck by objects that then force its tail to drop
3. It was removed intentionally or accidentally by a person
Someone accidentally or intentionally removed the gecko's tail.

How this happens?
It is possible to move parts of the body without any active control from the brain thanks to independently operating neurons called Central Pattern Generators(CPG). These neurons can cause parts of the body where they are found in to move independently from the brain(same goes for a headless chicken or roach). The tail according to research also seemed to be aware of it's environment, so if it hits a wall, it changes direction.
It is claimed that this sporadic movement may last up to 30 minutes.

Does the tail grow back?
Yes the tail grows back within 30 days.


Scientists are studying geckos and how this can help in treating spinal cord issues in Human
This post first appeared on [url]ugoayo.pythonanywhere.com[/url]
Programming / Web Monetization Explained by ColeDrain(m): 11:16pm On Jun 12, 2020
Web monetization in layman terms is making money from traffic to your websites, as easy as that. Most websites do this through:

Pay Per Click PPC- get paid when an ad is clicked by site visitors
Cost Per Impression CPI- get paid when an ad is displayed and viewed by site visitors

So basically the existing ways of making money from your website involved putting ads on your website, and truthfully ads atimes are very annoying, your privacy is invaded, user experience is diminished for example why will an ad cover the content of a web page you are reading, it's so annoying.

A new standard of making money on the web is being advocated, it is called the Web Monetization API.
Web monetization API seeks to solve the problems of present monetization schemes, that is no ads, no invasion of privacy, the user enjoys the website, and the website owner still earns.
From [url]webmonetization.com[/url], web monetization is a JavaScript Browser API which allows the creation of a payment stream from the user agent to the website, the payment occurs in real time. Just by adding a line of code to your website or specifying a streaming channel to earn.

How it works:
1. The website or website owner needs a wallet to receive payments.
2. User/ Website visitor needs a wallet to send payments.
3. The browser initiates payment in the background.

Chrome and Firefox browser support it as an extension.
Puma browser supports it totally.

So a future without annoying ads and privacy thieves may be possible. Keep this in mind.

Check out the following for more gist:
[url]webmonetization.org[/url]
[url]coil.com[/url]

This post first appeared on [url]ugoayo.pythonanywhere.com[/url]
Sports / Re: Coz Of His Wife's Instagram Post, He Lost His Job. by ColeDrain(m): 4:15pm On Jun 07, 2020
Vyzz:
The best way to fight racism is to get used to eat cuz there is no way I am seeing this stopped

Getting used to it??
The killings, the unwarranted privileges, the nepotisms... Na man.

Racism in the past was even worse but men and women stood up to fight against it... People like MLK or that woman refusing to sit at the back of the bus, those fights/protests surely did something, and more can be done...

2 Likes

Sports / Re: Coz Of His Wife's Instagram Post, He Lost His Job. by ColeDrain(m): 4:08pm On Jun 07, 2020
I feel sad for the guy tho.
But will it be safe to assume coz his wife is racist that he also is racist?

I think they were too harsh
Sports / Coz Of His Wife's Instagram Post, He Lost His Job. by ColeDrain(m): 4:01pm On Jun 07, 2020
The LA Galaxy released midfielder  Aleksandar Katai following racist social media posts made by his wife, Tea, the team announced Friday.

In a one-sentence news release, the team said it had "mutually agreed to part ways" with the midfielder, who joined the team before this season after spending the previous two campaigns with the Chicago Fire. The Galaxy reached a financial agreement with Katai and do not have any further financial obligations to the player.

The Instagram posts made by Tea Katai late on Tuesday, which have since been taken down, mocked protests related to the death of George Floyd while in police custody in Minneapolis last week. One post showed a police SUV attempting to drive through protesters in New York. A caption in Serbian read, "Kill the s---s!" while a second post showed a picture of an individual carrying boxes of Nikes with the caption "Black Nikes Matter."

The response from Galaxy fans was quick, with some demanding Katai's release. One social media post showed four fans holding a banner in front of Dignity Health Sports Park stating, "No Racists in Our Club," with Katai's No. 7 circled with a red slash through it.

Katai, 29, later posted a message on Instagram calling the posts "a mistake from my family" and saying he took full responsibility. He apologized "for the pain these posts have caused the LA Galaxy family and all allies in the fight against racism."

The Galaxy issued a statement Wednesday condemning the posts, saying, "The LA Galaxy stands firmly against racism of any kind, including that which suggests violence or seeks to demean the efforts of those in pursuit of racial equality."

At the time, the team said they would meet with Katai on Thursday to determine next steps. After the meeting, the two sides had decided to part ways.

Source:
https://www.espn.com/soccer/la-galaxy/story/4106585/galaxy-release-aleksandar-katai-after-wifes-social-media-posts

Celebrities / Re: Banky W Sacks His Chef For Stealing Cans Of Milo by ColeDrain(m): 10:42am On May 18, 2020
Nyamve1:
U sack someone he stole a can of milo and u are nt ashame u are saying it here

That was actually metaphorical.
European Football (EPL, UEFA, La Liga) / Re: "I Would Like To Play With Cristiano Ronaldo.kevin De Bruyne by ColeDrain(m): 10:31am On May 09, 2020
This news is quite old.
Programming / Re: Programmers:Your Thread Of Polls (Come and Vote Oh) by ColeDrain(m): 3:15am On May 09, 2020
J. I don't use a CSS framework/ I write the CSS myself.
Programming / Re: Programmers:Your Thread Of Polls (Come and Vote Oh) by ColeDrain(m): 3:14am On May 09, 2020
I. UI Kit
Programming / Re: Programmers:Your Thread Of Polls (Come and Vote Oh) by ColeDrain(m): 3:11am On May 09, 2020
h. Animate.css
Programming / Re: Programmers:Your Thread Of Polls (Come and Vote Oh) by ColeDrain(m): 3:10am On May 09, 2020
g. TailWind CSS
Programming / Re: Programmers:Your Thread Of Polls (Come and Vote Oh) by ColeDrain(m): 3:09am On May 09, 2020
f. Materialize
Programming / Re: Programmers:Your Thread Of Polls (Come and Vote Oh) by ColeDrain(m): 3:08am On May 09, 2020
e. Semantic UI
Programming / Re: Programmers:Your Thread Of Polls (Come and Vote Oh) by ColeDrain(m): 3:06am On May 09, 2020
d. Foundation
Programming / Re: Programmers:Your Thread Of Polls (Come and Vote Oh) by ColeDrain(m): 3:05am On May 09, 2020
c. Bulma
Programming / Re: Programmers:Your Thread Of Polls (Come and Vote Oh) by ColeDrain(m): 3:05am On May 09, 2020
b. Atomic CSS
Programming / Re: Programmers:Your Thread Of Polls (Come and Vote Oh) by ColeDrain(m): 3:04am On May 09, 2020
a. Bootstrap
Programming / Re: Programmers:Your Thread Of Polls (Come and Vote Oh) by ColeDrain(m): 3:04am On May 09, 2020
Question 15: What CSS framework?
Programming / Re: Programmers:Your Thread Of Polls (Come and Vote Oh) by ColeDrain(m): 3:02am On May 09, 2020
S. Others

(1) (2) (3) (4) (5) (6) (7) (of 7 pages)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 44
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.