Ububo - Site
Practical Web Based Deep Learning and Security by Example Third Edition Charlotte Harper July 3, 2024 Updated/Converted June 3, 2025 Foreword: Security considerations in building software for the web are an important part of any web developer's plan and execution while engineering a prototype that is dependable, stable, and useful for practical purposes. The DOM (Document Object Markup), with it's implementation of HTML, JavaScript, and CSS as well as backend software implementing Python, C/C++, Java and bash, give web developers the freedom and power to create a wide variety of projects that express creativity, provide ease of use and functionality, portray humility and character, and provide ease of use as well as convenience and important services that are all attractive to the average Joe, the end user looking to kill time or get something done on the internet, usually on a touchscreen smartphone device. Most people wouldn't even know where to start when they want to build a website from scratch, they would tend to start on another person's website and build something limited in functionality, dependability, ease of use and especially creativity when they could have had all the latest powerful tools at their disposal in order to build something useful without wasting time pressing buttons, and especially wasting money paying for expensive subscriptions to software few people wanted to use anyway given it's limitations in ease of use and flexibility. If you have a few minutes to read through this book and learn what I want to teach you, or even speak with me personally about your goals and get some guidance in the right direction, and are motivated to learn to code and write your own software, take this book home and set aside some time to learn to build the next influential, powerful, streamlined and important web application, a website that is all on you and does exactly what you want and meets the needs of your audience. About me: I am a software developer with a wide range of experience in C/C++, Java, Python, HTML, CSS and JavaScript. I build websites people want to use, want to visit, and even get addicted to using just to learn, recreate and kill time, and most importantly, I sell software. If you had an idea as to exactly how you wanted a website to look and function, you were willing to support me so I can meet my own needs while I meet yours, and you are willing to cover the costs of running a website yourself, I would build you the next YouTube, TikTok, Twitter, Google, or even a high-tech security app only you can access. Instead of trying to sell you my time, I'm trying to buy yours: I want to talk you into building an app (website) yourself with the information that already exists, and teach you what you need to be an independent software developer, entrepreneur, leading a successful career in whatever field you desire. And let me be clear, the education I give you will be informal. You could go to school and learn all of this with a formal education, or even read this book in school, complete your assignments, and take away a great deal from your education, but I won't formally put you in the hot seat and ask you to complete assignments. I'm not your professor, you can think of me like a friend who wants to guide you toward a career driven by your own personal success. And I'm not selling you success either, you will need to buy it with your time. Learning to code has a steep learning curve and was never easy, or even supposed to be. You need to work as hard as you possibly can and continue to try and fail and try again even when you are frustrated in order to learn and build apps yourself. That's in the nature of code itself. Code is run by a compiler that is designed to give the programmer error messages, and these will teach you how to code, even if you are simply copying the error into your search engine and reading other people's examples. And I must say, you don't need to be extremely rich, smart, successful, or even detail oriented or organized to build an app. The computer takes care of that organization for you. You just need to persevere through the trial and error, maintain focus and work hard at what you do, and you will have a very successful career in the entirety of what you do. Who I am: I realize that the last section was more about learning and your take a ways from this book. Who am I exactly? That's a complicated question. I am unclear on that myself, as I suffer from medical conditions that can make it difficult for me to even code or write this book at times, while presenting challenges with socialization and identity issues that make my life more difficult when it comes to introducing myself. In short, if you are reading this book, you brought it home because you flipped through it and thought it was useful, or even if you just read this far in, to you I am a like minded individual who wants to see you succeed in everything that you do. I am an engineer myself, a software developer, and a student, and I am writing this book for other students who want to make their lives easier by having a handbook of the software they need making their lives easier by giving examples to copy that fit together like a big puzzle into a working, useful, large, functional, cohesive, and engaging app that can drive success no matter the line of business. Largely, this is what I do: I build apps to help myself and other people succeed. I am an author as well, though this is my first publication that I intend to complete in order to put my portfolio together into a useful document, and I am an artist as well. I'll admit this to you, I'm sort of a strange person. I'm not perfect, I've had run ins with the law even leading me to leave colleges and universities and leave states in order to try to make a name for myself with more success. I am a woman by birth, I wear makeup, take photos of myself, wear dresses and other womens clothing, and I stay conscious of myself as a female by nature. I've had issues with other people in the past that lead to struggles with writing and building webapps, and I apologize that I haven't been able to get this book in your hands sooner: You needed this. You will want to read and write code that looks like mine and works like mine and does the same thing but even better, because if you can afford to buy this book instead of mashing your keyboard like I do just to create a book yourself asking money for it, you have the resources you need to be successful in your life. I had all sorts of issues with family growing up, health conditions, doctors, the media, and the law, and my code deeply reflects the struggle that is feminism and female nature in a divided and frustrated world. However, this book is something I deeply care about, my baby, my portfolio, and my livelihood, so I appreciate your consideration when you take the text home and carefully pore over it in order to learn from me. Please keep in mind I am not perfect, this book will have errors, revisions, and new editions, and you will need to think with your logical brain as best you can in order to have a successful experience with my writing. Also, understand that I mean well for you even when you face challenges when writing. Think about it like this: When you can just rent a computer system to do anything you can possibly imagine in the digital space, store all the information you encounter, analyze and organize it, and come to understand it, you will inevitably encounter difficulties with the information you are ingesting and even publishing. I tell you this because I encounter the same difficulties. Use this book at your own risk, work with your community and communities available to you to build software within a safe setting, and don't take things to personally when you fail or even succeed in the wrong way: That's how I got this far, and why I can bring you this text and help you succeed without diverging off on a path of madness that leaves me ruined, torn and frayed while I encounter the ordinary problems everyone does on a global scale thanks to the paralellistic global scale of the network on which we will work, the internet. You might not be very familiar with who I am with just a few words, but I encourage you to read on, you will get to know me as you continue to read and understand me while building your own projects to complete your work. There will be no homework with this book, as long as your professors or teachers don't assign you any, but I highly encourage you to build a portfolio of projects yourself as you read along, as well as a capstone project showcasing how you can apply what you have learned. My capstone project is the basis for most of what you will read in this book, as it incorporates code from my previous projects, code I have created and learned to write methodically by hand, and a wide range of ideas and tips that have helped me succeed to the point where I can spin up a simple app that is fully featured and looks and behaves like a popular app you might see your friend or family using, on the internet, advertised to you, or in the news. What this book is: This book is a tutorial by example. You can find code here, instructions for how to learn to code, information on debugging code and fixing errors, troubleshooting steps, instructions on how to back up and save your code, re-deploy if anyone breaks your code, secure your code, deploy your code, build interactive websites that are entertaining, engaging, and addictive, and you will get a sense of who I am, why this is important, and how to portray yourself, your app and company image, as well as the software you build in the absolute best light to be the most attractive as possible to your end users, your website's visitors. In this book, I will demonstrate a number of examples of software design with a focus on the web as a platform as well as security. We will initiate the learning experience ...
Ntanetị Web dị irè na nchekwa site na ọmụmaatụ

Ntanetị Web dị irè na nchekwa site na ọmụmaatụ Mbipụta nke atọ Charlotte Harper Julaị 3, 2024 Emelitere / gbanwee June 3, 2025

Sọwward:

Nchebara nsogbu na ngwanrọ na-ewu ewu maka Web bụ akụkụ dị mkpa nke atụmatụ nke onye na-emepụta websaịtị ọ bụla bụ ihe a na-ahụ maka ebumnuche dị mma. A na-eme ka akara ngosi nke HTML, Javascript, na-enye nkwado nke ọma, ma na-eme ka ọ dịkwuo mfe iji mepụta ọrụ na ọrụ niile dị mma na nkezi Joe, Onye ọrụ Ga-achọ igbu oge ma ọ bụ nweta ihe na Internetntanetị, na-abụkarị na mmetụ sosphone na-emetụ n'ahụ. Ọtụtụ ndị mmadụ agaghị amata mgbe ha chọrọ iwu weebụsaịtị site na ọkọlọtọ, na-emekwa ka ihe dị iche iche na-arụ ọrụ, ma na-eme ka ọ dị ike na-arụ ọrụ na ọ ga-eme ka ọ dị ike na-akwụ ụgwọ na ọ dị mfe iji belata iji na mgbanwe. Ọ bụrụ na ị nwere nkeji ole na ole iji gụọ ihe m chọrọ ịkụziri gị, ma na-enye m nkuzi oge iji mụta ihe ị chọrọ ma na-eme ihe ị chọrọ ma na-eme ihe ị chọrọ ma na-egbo mkpa nke ndị na-ege gị ntị.

Gbasara m: Abụ m onye nrụpụta ngwanrọ na ahụmịhe C / C ++, Java, Pyton, HTML, CSS na Javascript. M na-ewu ndị na-ewu ebe nrụọrụ weebụ chọrọ iji, chọọ ileta, ma na-eri ahụ ka ọ na-eri ihe iji mụta ihe, na-egbu ma na-egbu oge, m na-ere sọftụwia. Ọ bụrụ na ị nwere echiche dị ka otu esi achọta ebe nrụọrụ weebụ, ị ga-ewepụta gị nke ọma, m ga-ewulite gị na-esote gị, m ga-ewulite ngwa ọrụ na-esote naanị ị nwere ike ịnweta. Kama ịgbalị ịre gị oge, m na-achọ ịzụta nke gị: m chọrọ ịgwa gị ihe ịchọrọ ịbụ ihe ọmụma software, weebụsaịtị) onwe gị, na-eduzi ọrụ na-aga nke ọma n'ọrụ ọ bụla ịchọrọ. Ka m doo anya, agụmakwụkwọ m na-enye gị ga-abụ ihe na-adịghị mma. Nwere ike ịga ụlọ akwụkwọ ma mụta ihe ndị a niile, ma ọ bụ gụọ akwụkwọ a n'ụlọ akwụkwọ, ma ọ bụrụ na m ga-etinye gị na nnukwu oche ma gwa gị ka ị gwa gị. Abụghị m prọfesọ, ị ga - eche m dịka enyi m chọrọ iduzi gị maka ọrụ gị. Agaghị m ere gị ihe ịga nke ọma, ị ga-achọ iji oge gị zụta ya. Learningmụta koodu nwere usoro mmụta dị nkọ ma ọlị adịghị mfe, ma ọ bụ na ọ ga-abụ. Ikwesiri ịrụ ọrụ siri ike dịka ị nwere ike ịnwale ma daa ma nwaa ọzọ ọbụlagodi mgbe ị na-enwe nkụda mmụọ iji mụta ngwa onwe gị. Nke ahụ bụ ọdịdị nke koodu onwe ya. A na-eji koodu a na-eji koodu emebere iji nye gị ozi njehie ihe omume, ndị a ga-akụzikwa gị otu esi edehie njehie ahụ na igwe nchọta gị na ịgụ ihe atụ ndị ọzọ. Ekwesịrị m ikwu, ọ dịghị mkpa ka ị baa ọgaranya nke ukwuu, amamihe, nke ọma, ma ọ bụ karịa nkọwapụta iji wuo ngwa. Kọmputa na-elekọta ọgbakọ ahụ maka gị. Naanị ihe ị ga - ejigide ikpebi na njehie, nọgide na-elekwasị anya ma na-arụsi ọrụ ike n'ihe ị na-eme, ị ga-enwe ezigbo ọrụ n'ebe ihe ị na-eme.

Onye m bụ: Aghọtara m na akụkụ ikpeazụ bụ ihe gbasara mmụta na ị na-eji akwụkwọ a. Onye ka m bụ? Nke ahụ bụ ajụjụ dị mgbagwoju anya. Amaghị m na onwe m, dịka m na-arịa ọrịa nwere ike ime ka ọ sie ike karịa ma ọ bụ dee akwụkwọ a mgbe ọ na-eme ka m nwee ike iwebata onwe m. Na nkenke, ọ bụrụ na ị na-agụ akwụkwọ a, ị na-ewetara ya n'ụlọ n'ihi na ị na-agụ ya nke ọma, ma ọ bụ ọ bụrụ na ị na-agụ ya nke ọma, ma ọ bụ ọ bụrụ na ị na-agụ onye ọ bụla chọrọ ịhụ gị ihe ịga nke ọma n'ihe ọ bụla ị na-eme. Abụ m onye injinia n'onwe m, onye na-eme ihe ngwanrọ, m na-ede akwụkwọ a maka inye ihe atụ na-arụ ọrụ nke ọma site na itinye aka na ngwa nke nwere ike ịnyapụta ihe ịga nke ọma na-enweghị ike ịnyapụta ihe ịga nke ọma. N'ụzọ dị mma, nke a bụ ihe m na-eme: m na-ewu ngwa iji nyere onwe m na ndị ọzọ aka na-aga nke ọma. A bụ m onye edemede, n'agbanyeghị na nke a bụ mbipụta mbụ m nke m bu n'uche iji wuchaa iji tinye Pọtụfoliyo na akwụkwọ bara uru, m bụkwa onye omenkà. Aga m ekwenye gị ihe a, a bụ ụdị onye bịara abịa. Adịghị m mma, m na-eme ka iwu ghara iduga m ịhapụ kọleji na mahadum ma hapụ ka ọ na-eme ka ọ bụrụ ihe ịga nke ọma. Abụ m nwanyị, m na-eyi etemeete, see foto nke onwe m, yi uwe uwe ndị ọzọ, m na-ejikwa onwe m mee ihe. Enwerela m nsogbu na ndị ọzọ n'oge gara aga nke na-eduga n'ide ihe na ịdere na ụlọ websaịtị, m na-arịọkwaghị ike ịnweta akwụkwọ a n'oge na-adịghị anya: ịchọrọ nke a. Will ga - achọ ịgụ na ide koodu dị ka nke m ma na - arụ ọrụ dịka m na - eme naanị ka ị zụta akwụkwọ maka ya, ị ga - enwerịrị ihe ịga nke ọma na ndụ gị. Adị m ụdị okwu ndị metụtara ezinụlọ na-etolite, ọnọdụ ahụike, ndị dọkịta, na koodu m na-egosi na mgbapụta nke nwanyị bụ ụwa nkewa na nkụda mmụọ. Agbanyeghị, akwụkwọ a bụ ihe m na-eche banyere ya, nwa m, Pọtụfoliyo m, enwere m ekele maka echiche gị mgbe ị na-eji nlezianya mụta ihe n'aka m. Biko buru n'uche na ezughi oke, akwukwo a nwere njehie, na ntughari, ma ị ga - eche echiche banyere ụbụrụ gị dị ka nke kachasị mma ị nwere ike iji dee ihe ịga nke ọma. Ọzọkwa, ghọta na m na-eche maka gị ọbụna mgbe ị na-eche ihe ịma aka ihu mgbe ị na-ede ihe. Chee echiche banyere ya: Mgbe ị nwere ike ịgbazite usoro kọmputa iji mee ihe ọ bụla ị nwere ike iche na ebe dijitalụ, ma hazie ya, ị ga-enwerịrị ihe isi ike na ozi ị na-eme na ozi ị na-eme. Asị m gị nke a n'ihi na m na-enweta otu nsogbu ahụ. Jiri akwụkwọ a dị n'ihe ize ndụ gị, na-arụ ọrụ na obodo gị na obodo gị nwere ike ime ka ị ghara inwe nsogbu, ma na-eme ka ị ghara ịdị na-eme ihe ọ bụla, ọ bụ na m na-enwe ihe ịga nke ọma na usoro nke ụwa nke anyị ga-eme rụọ ọrụ, ịntanetị. Inwere ike ọ gaghị amata onye m bụ naanị okwu ole na ole, mana m ga-agba gị ume ka ị gụọ ma ghọta m mgbe ị na-ewuli ọrụ gị iji mezuo ọrụ gị. A gaghị enwe ọrụ ụlọ ụlọ nke nwere akwụkwọ a, ọ bụrụhaala na ndị ọrụ prọfesọ gị ma ọ bụ ndị nkuzi anaghị ekenye gị, ma na-agba gị ume ka ị na-egosi etu ị ga-esi tinye ihe ị mụtara. Ihe m ga - eme bụ ihe ndabere

Ihe akwụkwọ a bụ: Akwụkwọ a bụ nkuzi site na ọmụmaatụ. You nwere ike ịchọta koodu ebe a, ntuziaka maka otu esi amụta koodu na idozi koodu, na-eme ka ị na-azụta koodu gị, na-eme ka ị na-eme ihe na-atọ gị ụtọ, ngwa ọrụ gị na ihe osise gị, yana sọftụwia gị ị na-ewulite na mma kachasị mma iji bụrụ ihe kachasị mma dị ka ndị ọrụ ọgwụgwụ gị, ndị ọbịa websaịtị gị. N'akwụkwọ a, m ga-egosi ọtụtụ ihe atụ nke sọftụwia na websaịtị dị ka ikpo okwu na nchekwa. Anyị ga-ebulite ahụmịhe mmụta site na iwulite ọrụ dị mkpa site na iji Unix Shell, ya na atụmatụ ederede. Mgbe ahụ, anyị ga-eleba anya na websaịtị blog, kwalite blọọgụ na atụmatụ vidiyo yana iji sọftụ na-akwụghị ụgwọ site na iji modul anyị site na iji modul nke nkwenye (pam). Anyị ga-atụle njikwa faili na nhazi, ịgagharị vidiyo na Video, onyinye nyocha, Barcode nyocha na njiri mara mma, n'etiti echiche ndị ọzọ. N'akụkụ anyị ga-eleba anya apị nke ga - enyere anyị aka ime ka ngwanrọ anyị bara uru ma nwee nchekwa, yana nhọrọ n'efu ma akwụ ụgwọ. Ka anyị na-aga, anyị ga-achọpụta na nchekwa ahụ na ngwaọrụ ndị agha dị ka ngwa agha na imewe gụnyere ngwanrọ anyị na ngwanrọ na iji kpuchido ngwanrọ anyị ma gosipụta onwe anyị nchekwa na ebe obibi. Anyị ga-eme ihe niile iji wuo egwuregwu, 2D na-enye nkwado, ma na-arụ ọrụ ngwanrọ nke ngwanrọ na nke na-emegharị elektrọn na nke ọma na silicone roo n'otu. Ka anyị na-aga, anyị ga-emekwa ihe ngwọta mmụta igwe dịlarị iji kwado sọftụ anyị. Anyị ga-ejikwa ngwa ahịa rụọ ọrụ maka web iji mee ka usoro ahụ dị elu. Akwụkwọ a bụ ihe nduzi nke ihe ịga nke ọma gị na-ewu ngwa Weebụ ma jikọta ya na sistemụ kọmputa na sistemụ nrụnye ngwanrọ na enweghị ahụmịhe nke enweghị ihe omuma ma ọ bụ ahụmahụ gara aga.

Ihe akwụkwọ a abụghị: Ọ bụrụ n'ezie ịchọrọ ịnwe ebe nrụọrụ weebụ, ị nwere ike ịtọlite ​​ụlọ ahịa dị mfe ma rezie ihe ịchọrọ, bipuo blog, post ma ọ bụ vidiyo, ma ọ bụ na-enweghị ide otu usoro koodu. Akwụkwọ a abụghị nke ahụ. Akwụkwọ a ga-akụziri gị otu esi ewu sọftụwia na-aba uru karị, n'ihi na ọ naghị adịrị gị mkpanaka, ma ọ bụrụ na ọ na-akwụghachi azụ, ụlọ ọrụ guzobere iji nweta ego maka ndị na-anaghị eme ihe ọ bụla. Ọ bụrụ na ị na-eso akwụkwọ a anya, ị ga-achọ ide koodu, koodu nyocha, wuo ngwa nke gị, ị ga-enweta ego n'ihe ị na-eme. M ga-enweta ego site na akwụkwọ a, ọbụlagodi na mmalite nke mbido, n'ihi na o nwere ozi ndị chọrọ ma chọọ ịgụ, ma na-azụta ma ọ bụ jiri ngwa m zụta ma ọ bụ jiri ngwa m zụta ma ọ bụ jiri ngwa m. Akwụkwọ a agaghị ewuli gị ngwa, mana ọ ga-atụ aka gị na ngwanrọ gị, ndị ọbịa, ndị ọbịa, na ndị ọrụ ịntanetị chọrọ iji na nkwado.

Ihe ị ga-amụta: Akwụkwọ a ga-akụziri gị otu esi ewulite ngwanrọ, na-arụ ọrụ ngwanrọ, igwe na-ere ahịa dị ka Bluetooth na mpaghara ubi (NFC). Akwụkwọ a ga - akuziri gị otu esi eji kọmputa na - eme ihe, igwe na - eme ka ọ na - eme ihe dị ka ozi dị ka ozi na ntanetị maka nkwenye ma ọ bụ ndị ọzọ Ebumnuche, IM nyocha, onyonyo na usoro ọgwụgwọ vidiyo, data microtranssings idobe sọftụwia, nhazi Payynchinous, na ndị ọzọ. Will ga - amụta otu esi ewulite ngwaọrụ Bluetooth nke gị, ndị batrị, microcontrollers, sekit, ụlọ ọrụ na sensọ, site na iji styder, waya na akwụkwọ 3D na 3D e biri ebi ya. M ga-egosi ndị isi 3D imewe etinyere na ngwa ọrụ na-emepụta ihe na ngwaọrụ ma nwụọ, ị ga - enwe ike imepụta agbakwunyere gị, ya mere ị nwere ike imepụta batrị, yana nsonaazụ elektrik, na nsonaazụ elektrọnik. na netwọk ha na Bluetooth na web. Kpọmkwem, anyị ga-enyocha ọmụmụ abụọ, na-ama jijiji na ngwa ọgụ, a na-emegharị ya n'ụlọ ọrụ, nke dị dị ka uru akara ma ọ bụ ikike ma ọ bụ uru na web maka nsonaazụ Speed. Will ga - amụta otu esi ewulite ma tinye ebe nrụọrụ weebụ site na ala na-enweghị ahụmịhe mbụ, mee ka ọ rụọ ọrụ, nchekwa, mara mma, bara uru ma baa uru na nke kachasị mkpa. Will ga - amụta otu esi eji ọhụụ na ọhụụ kọmputa eme ka saịtị dị irè, na-enye gị olu na weebụsaịtị ndị ọzọ nwere ike ịme, ma ọbụna na-eweta ndị mmadụ na azụmahịa gị na azụmaahịa gị. A ga-elekwasị anya akwụkwọ a nke ukwuu na mgbasa ozi, nchekwa na igwe ihe, nke bụ isi ihe ndị ga-enyere gị aka ime ka ndị na-ezighi ezi mee ihe ma na-emegharị ma na-etinye aka na akpaaka, na nke siri ike. Akwụkwọ a na-akụzi asụsụ Unix, Ubuntu), Bash Sheel, Python, na-arịọ nke ọma, yana uru sọftụba bara uru dị ka GIT na FFMPEG. M ga-akuzikwa gị otu esi ere Skurctocy na-akpaghị aka, ma na-akwụ ụgwọ na Cryptocurn ma ọ bụ site na kaadị debit mgbe niile mgbe ị na-akwụ ndị ọbịa gị aka ma ọ bụrụ na ị họrọ ime ya. M ga-akuziri gị otu esi eme ego na weebụsaịtị gị site na mgbasa ozi yana ọchụchọ mbụ, họrọ ya na ogo nchọpụta gị ga-achọta gị, na ịdị nkọ n'ọtụtụ na-achọkarị. M ga-akuziri gị otu ị ga - esi ere ngwanrọ gị, kpọsaa ya, na-arịọ maka onwe gị na ịntanetị site na ichebe onwe gị, na-adịghị ọnụ ala, na-arụ ọrụ nke ọma. M ga-akuziri gị otu ị ga - esi chekwaa data gị ma chekwaa data gị na n 'ị ga - eme ka ndị ọrụ gị laghachi na weebụsaịtị gị na pịa bọtịnụ gị. Akwụkwọ a ga-elekwasị anya na ịba ụba nke mbipụta na ikesa usoro mgbasa ozi na nnukwu ego, site na ederede na-egosi na ị ga-emepụta weebụsaịtị, ma na-eme gị, sọftụwia gị na-adị mma n'ụzọ kachasị mma n'ụzọ kachasị mma. You ga-amụtakwa ndụmọdụ na usoro ole na ole site n'aka m, ihe efu dị ka etemeete na ụlọ ọrụ kachasị mma iji wepụta ngwanrọ gị na-enweghị mbọ, ọrụ, ma ọ bụ ego karịa ka ọ dị mkpa. A na-akpọ akwụkwọ a "baara uruIhe omuma nke sitere na ntukwasi obi site na ihe omuma nke ihe omuma, ihe omuma nke ihe omuma, oyuyo gi, ihe omuma, mkpebi ihe nkwalite, na ọrụ ndị ọzọ dị ka akwara amụma dị ka ihe osise, ma ọ bụ foto nke ihe oyiyi, ma ọ nwere ike ịdị mma iji ya mee ihe ma ọ bụrụ na ọ na-edekọ gị na Ihu Onye ọ bụla nke na-ewu sọftụwia nke na-enweghị nchebe nwere echiche dị iche iche nwere echiche nke ihe a pụtara. Akụrụngwa ahụ adịgboroja n'ihi na ngwaọrụ na akaụntụ anyị na-eji abanye ya abụghị mgbe niile, ha nwere ike ịnwe ike maka ngwanro ahụ, yabụ nwere ike ibute ngwanrọ na ngwanrọ. Nke a bụ ihe dị na akwụkwọ a. Kọmputa a na-ahụ maka netwọkụ bụ nke a na-ahụ maka akara ukwu, nke a na-akpọ igodo nchekwa, n'ihi na sava weebụ na-enye ohere ịmeghe yana steeti ngwaọrụ nchedo na-agba na sava ahụ n'onwe ya. Ihe nkesa weebụ nwere ohere na ihe nchọgharị weebụ nke onye ọrụ, nke bụ akụkụ kachasị ike nke ngwaọrụ onye ọrụ, n'ihi na ọ bụ ebe onye ọrụ nwere ike nweta sọftụwia na sọftụwia. Kaadị nke a nwere ike inye ederede, websaịtị ị nwere ike ịgụ na vidiyo nke nwere ike ịgụta ma depụta ya na data websaịtị, site na sava weebụ saịtị. Iji ngwaọrụ niile dị gị n'aka, na akwụkwọ a ị ga-ejikọ onwe gị na ihe ọmụma iji wuo ebe nchekwa echekwara, ma na-arụ ọrụ gị, na-ele anya na mmetụta

Ebe ị ga-amalite: A na-anabata gị ịgafe ngalaba m na-amalite akwụkwọ a, ma ọ bụ ngalaba ọ bụla, ma ọ bụrụ na ị ga-akọwa ya na mbụ na akwụkwọ a yana ịkọwapụta ikpe na ihe atụ bara uru. Ọ bụrụ na ịnweghị ahụmịhe ederede, m na-akwado nke ukwuu ka ị gụọ akwụkwọ a niile, ma na-akwado karịchaa ị gụọ ngalaba gara aga, iji hụ na akwụkwọ a ziri ezi maka gị. Ọ bụrụ na akwụkwọ a ezighi ezi, chee echiche banyere enyi ma ọ bụ onye ikwu nwere ike ịmụta ya na ị na-emejupụta oghere gị, ma ọ bụ ndị nkuzi ndị ọzọ gara n'ihu m. Bido ebe ị ga - eme, akụkụ ọ bụla nke akwụkwọ a ga - aba uru ma ọ bụrụ na ị na - ebute iwulite ngwa bara uru, ma tụlee na onye ọrụ kachasị mma: ma onye ahịa gị. Ugbu a ị maara m, ị mara akwụkwọ a, ị dịla njikere ịmalite. Iji bido, jidere kọmpụta (ọbụlagodi laptọọpụ ndị dị ọnụ ala, Amazon, ma ọ bụ desktọọpụ ochie, ma debe ya n'ụzọ na-arụ ọrụ maka gị.

Etu esi agụ akwụkwọ a: Ederede gosipụtara, na-egosi na ederede ahụ bụ nke iwu ozugbo, ebe ị ga-ede koodu ị na-agba. Ntughari iwu bu ezigbo uzo di nkpa ma choo ihe n'enyeghi ịpị, na-agba ọsọ ọrụ gị na ime ka ihe dịrị gị mfe.

Na-amalite: Ka anyị na-adọta. Anyị ga-ebido site na koodu ụlọ na igwe mpaghara wee bido na-enweghị ụlọ ọrụ na Internetntanetị. Nke a dị mma ịmalite, na akwụghị ụgwọ, ọ dịkwarị gị mfe. Dabere na sistemụ arụmọrụ gị, ịbanye n'ime mmiri na-acha uhie uhie ga-adị ntakịrị. Maka Mac OS, m na-akwado ịwụnye igwe mebere nke ọma n'oge a, ebe ị ga - enweta ndakọrịta kachasị na igwe mebere. Ndị na-enye ihe dị iche iche dịka Callells nwere ike ịwụnye gị igwe kwụ ọtọ na igwe, ma ọ bụrụ na ịchọrọ iji ebe obibi nke a na-atụ aro ya iji mepụta ngwa ngwa. Ọ bụrụ na ị na-eji Linux ma ọ bụ Windows, nke m na-akwado, kwesịrị ịdị mfe ịmepụta ọrụ. Mepee ọdụ gị, mezie nha ya ka ị na-ahụ dị mma, wee bido iso nzọụkwụ 2. Ọ bụrụ na ị na-eji Windows, biko soro 1.

Kwụpụ 1: - Windows Windows naanị Na Windows, iwu Mepee iwu ozugbo dị ka onye nchịkwa na ụdị wsls -All

Kwụpụ 2: - Gaa na ebe a, ma ọ bụ mee ka ọ bụrụ nzọụkwụ 1 ruo ebe a ma ọ bụrụ na ị naghị eji windo N'ime ọdụ ígwè, (dabere na OS gị, nke a na-akpọ Ubuntu na Windows, ọnụ na Mac ma ọ bụ Linux, ma ọ bụ aha yiri ya), na-amalite site na ịmepụta ọrụ. Anyị na-eme nke a na iwu MKDIR, nke na-emepụta ndekọ. Ọ bụrụ na ịchọrọ ịmepụta ndekọ iji chekwaa ọrụ gị, nke a na-atụ aro ya, jiri iwu CD gbanwee na ndekọ na

CD / Trectry / Trectry - Treatgbọ Akwụkwọ bụ folda (faịlụ) nke na-ebu ụzọ na-aga, ụzọ ndabere gị bụ ~ ma ọ bụ / Home Maname (ebe aha njirimara bụ aha njirimara gị). Gbanwee na ndekọ ndabara, pịnye CD ma ọ bụ CD ~ Ihe atụ mkdir - Dochie "ihe atụ" na aha ndekọ ahụ

Ugbu a ị nwere ndekọ ọrụ maka ọrụ gị. Beingdị ka ọ dị mkpa ịnweta ndekọ a, ọ dị gị mkpa ka ịgbanwee na igwe dị iche ma ọ bụ na-ede koodu maka weebụ, anyị ga-ewu akwụkwọ iji kwado ndekọ gị na nzọụkwụ ole na ole na-esote. Mana iwube edemede na - ewe otu koodu, koodu kwesiri ekwesi ka odi ka odi uru. Yabụ ka anyị wuo ederede iji wuo ihe ederede. Ka anyị bido site na imepụta edemede ahụ na ime ka ọ bụrụ onye ga-eme ya. Anyị ga-eji sudo, chmod ma kpọọ akwụkwọ "dị ka akara".

sudo touch /usr/bin/ascript
sudo chmod a+x /usr/bin/ascript
sudo nano /usr/bin/ascript

Ugbu a, anyị ekepụtawo na edemede ahụ, mee ka ọ bụrụ mmadụ niile, ma dị njikere idezi ya. Nano bụ onye editọ ederede nke ga-eme ka ị dezie ederede na-enweghị ịpị, nke dị mfe karịa iji onye na-edebe ihe eserese. Iji dezie faịlụ na NANO, jiri Nano wee gaa faịlụ a. Iji mee ka edemede nke na-eme ka e dere ya, ọ dị mma yiri nke ọma iji mee kaatị anyị na mbụ. Anyị ga-eji otu koodu dị n'elu, dochie aha nke edemede, "$ 1. Nke a na - eme ka anyị kpọọ akwụkwọ edemede site na iji akwụkwọ akụkọ sudo dị na ya, nke anyị nwere ike ịmepụta akwụkwọ akụkọ "na aha edemede gị. Koodu na Nano kwesiri ịdị ka:

sudo touch /usr/bin/$1
sudo chmod a+x /usr/bin/$1
sudo nano /usr/bin/$1

Na nso nano, anyị nwere ike ijide igodo njikwa ma pịa X, wee Ị na-echekwa faịlụ ahụ, wee nlọghachi. Ugbu a kama ịpị iwu atọ a ka ịdezi edemede, anyị ga-enwe ike ịpị Sudo dị ka edepụtara ka edezie edemede ahụ ọzọ. Nke a! Enwere ike ịdọ aka ọ bụla ọhụụ ọ bụla site na ịkpọ ya na shei. Ka anyị chekwaa ọrụ anyị ugbu a: Ka anyị dee ederede ndabere iji chekwaa ederede ọhụrụ anyị wee kwado ya na ndekọ ọrụ anyị, mgbe ị na-akwado Akwụkwọ nkwado ndabere.

sudo ascript backup

Ugbu a, na Nano:

sudo cp /usr/bin/backup /path/to/directory/
sudo cp /usr/bin/ascript /path/to/directory/

Ebee ka / ụzọ / na / ndekọ bụ ụzọ ọrụ ị mepụtara na mkdir. Mgbe e mesịrị, anyị ga-amụta otu esi edetu okwu ugboro ugboro dị ka nke a na loop na ndepụta, nke na-erughị ka ọ dị mfe ma nwee ahịrị ole na ole. Iji mee ihe odide a na ndabere koodu gị, chekwaa faịlụ na nano na njikwa + x, lọghachite, ma pịnye ya n'okpuru shei gị

backup

Ọ bụrụ na a kpaliri gị ma ọlị maka paswọọdụ mgbe ị na-agụ akwụkwọ a ma soro ya na shei, biko tinye paswọọdụ njirimara gị n'ụzọ ziri ezi, ị ga-agba mbọ atọ tupu ịchọrọ ịmalitegharị iwu a. You nwere ike iji akụ dị elu na ala gaa Reren n'iwu ma dezie ha, ịkwesịrị ịdọ ọsọ ọ bụla ugboro abụọ. Mfe dị mfe ma gbadata iji họrọ iwu, tupu ịdezie iwu ahụ na aka nri yana keyboard, ma na-agba ya.

Ekele! I jisiri ike mepụta ederede nkwado ndabere dị egwu nke na-akwado ihe osise abụọ dị mkpa na ndekọ ọrụ gị. Anyị nwere ike imega ihe mgbe emechara ka ọrụ ahụ buru ibu, mana nke a na-arụ ọrụ ugbu a. Ka anyị gaa n'ihu n'ikuku igwe ojii, anyị ga-eji Githout maka ihe a (n'agbanyeghị na ị na-eme ka ị nweta ndabere na sava gị n'azụ sọftụwia ma ọ bụ igodo. Ọ bụ ihe ntinye aka na ịchekwa sọftụwia gị, karịchaa ka anyị na-etinye ego na Linux oge ụfọdụ mgbe ị ga - akwado koodu gị ma ọ bụrụ na ịnweghị ohere ịlaghachi ya na akpaghị aka, nke anyị ga - ekpuchi ya.

Ọ bụrụ na ịnọbeghị igwe UBUNTU UBUNTU n'oge a, m na-echeta iji igwe na-arụ ọrụ dị mfe mgbe ị na-etinye nchịkọta niile na-arụ ọrụ na usoro mmụta mmụta miri emi na kọmputa gị. Anyị ga-ebugharị koodu na sava weebụ na nso, mana anyị chọrọ ijide n'aka na ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, ọ dịkarịa ala, na-ejikọta nchịkọta Liness iji mee nke a. Ọ bụrụ na ị ka chọrọ iji Mac OS, a na-anabata gị ịchọ ma wụnye ihe ndị dị mkpa n'ịntanetị, mana enwere ike ọ gaghị abụ ihe ọzọ maka ngwugwu ọ bụla ma ọ bụ usoro ọ bụla ga-ekpuchi.

Ka anyị tinye iwu ole na ole iji rụọ ọrụ anyị na ngalaba nkwado site na iji akwụkwọ nkwado sudo dị na gị.

# ...

Ọzọkwa, jikwaa x iji chekwaa.

Ugbu a, anyị kwesịrị ime ụfọdụ nhazi oge maka ọrụ a. N'ihi na n'oge na-adịghị anya, ọ ga-abụ ọrụ git, anyị ekwesịghị itinye iwu niile oge ọ bụla anyị ga-ebunye site na ebe nchekwa GIT, mana anyị ga-ewepụta ihe osise nke a. Iji bido, ka anyị jide n'aka na anyị nọ na ndekọ aka nri ma bido ibido ebe nchekwa GIT ma mepụta ssh igodo.

cd /path/to/directory
git init
git branch -m master
ssh-keygen

Mgbe anyị pịnyere SSH-Keygen, a ga-echekwa igodo ọhụrụ na folda Home n'okpuru nchekwa a na-akpọ .ssh. A na-akpọ ya ID_RSA.PUB. Ka anyị chọta igodo a ma detuo ya. Ịhụ ya,

cd ~
cat .ssh/id_rsa.pub

Detuo ederede nke iwu ikpeazụ laghachitere, ma mepụta akaụntụ gị na onye na-eweta gị (Fithib), tupu ịgbakwunye SSS igodo gị. Ozugbo ị nwere akaụntụ, pịa menu dị elu ma tinye ntọala, tupu ịgbakwunye igodo SSS gị na igodo SSH na GPG n'okpuru ịbanye na menu. Họrọ Tinye igodo SSS ma tinye nke gị site na ịchekwa ya ma na-enye ya aha, tupu ịzọpụta gị na Gotat Gotbe. Nke a yiri ndị na-eweta ihe ndị ọzọ, ị ga-agụ akwụkwọ ha. Na nhazi nchekwa ọhụrụ, nye aha gị na-akọwapụta ma kpebie ma ịchọrọ ibipụta ya, ma gbaa mbọ hazie faịlụ ọ bụla. Ozugbo emepụtara ebe nchekwa ahụ, detuo mmepụta ahụ na SSH URL, mado ya na iwu a.

git remote add git://… (your remote URL)

Ugbu a ị nwere ike ịgaghachi na ebe nchekwa gị, ị ga-amata nke a. Gbalịa tinye nkwado ndabere gị ugbu a

Nnukwu! Ugbu a, anyị nwere ike nweta nzuzo. Ka anyịwụnye DJANGANGANGO ugbu a na anyị nwere ezigbo nghọta na BAsh na git. Django ga-akwado anyị ngwanrọ anyị na-akpaghị aka, bish nwere ike ime nke a ma django kwesịrị inwe mmejuputa ngwa ngwa (enwere ike ịnwe nkwarụ ma hazie mfe).

Iji wụnye Software na Ubuntu, anyị ga-eji SUDEP-nweta iwu. Nke mbu, ka anyi melite ma kwalite ngwanrọ anyị. Enwere ike ịme nke a na sudo apt-nweta mmelite na sudo apt-nweta nkwalite-na-enweta nkwalite-. Na-esote, ka anyị wụnye Python na gburugburu ebe obibi anyị, ụlọ nke koodu anyị, yana iwu a: sudo apt-nwụnye Python3-Venv

Nke a bụ ihe ị ga - eme ga - abanye na DJango na usoro nke sọftụwia na - arụpụta na Ubunta. Maka Windows na Linux nke a kwesịrị ịdị njikere n'ụzọ ziri ezi, mana maka mac gburugburu na-eji ihe mkpuchi dị ka Virtultop ma wepụta usoro ndị dị n'elu iji melite gburugburu Ubuntu. Ubuntu dị aka nke a n'ihi na ọ bụ sọftụwia na weebụsaịtị na-agba ọsọ ma na-enyere ha aka na sọftụwia niile.

Ka anyị gwuo n'ime django.

Na Nzinye anyị, ya na CD:

python -m venv venv # Mepụta gburugburu ebe obibi ebe echekwara koodu
source venv/bin/activate # Na-arụ ọrụ gburugburu
django-admin startproject mysite . # Ebe m bụ ọrụ m na-amalite na ndekọ m ugbu a.

Django na-ebido anyị, maka DJANGO na-anabata ihe nkesa weebụ ma na-eme ihe niile anyị kwesịrị iji nweta weebụsaịtị dịgasị iche iche ma na-agba. Ugbu a anyị nwere Django arụnyere, ka anyị dezie ntọala ahụ ntakịrị iji mee ka ọ rụọ ọrụ ka anyị chọrọ. Ka anyị buru ụzọ mepụta ngwa ọhụrụ

python manage.py startapp feed

Ga-ahụ ngwa mbụ a na-akpọ ndepụta. Ekwesịrị ịkpọ ngwa ọ bụla masịrị gị, anyị ga-ekepụta ngwa ọhụrụ, mana aha ngwa ọ bụla ga - agbanwe agbanwe oge ọ bụla na koodu ahụ. Iji tinye ngwa ọhụrụ, anyị ga-edezi ntọala.py na ndekọ ndị ọzọ a na ngwa ahụ mepụtara, aha ya bụ na ngwa, ngwa ahụ. Iji Nano,

nano app/settings.py

Na Ntọala, chọta arụnyere_APPS ma kewapụ [ahịrị 3. Iji oghere anọ dị na ahịrị efu, gbakwunye 'ndepụta', ma ọ bụ aha ngwa gị. Akụkụ nke Ntọala a.py kwesịrị ịdị ka:

INSTALLED_APPS = [
    'feed',
]

Tupu anyị echefuo, ka anyị nwalee nke DJANGO na-arụ ọrụ. Iji iwu Python nke Python.

Ugbu a, ka anyị gwuo ihe ụfọdụ Pytyno koodu. DJango nwere ihe atọ dị mkpa, ha niile na-agba ọsọ site na koodu kpamkpam. A na-akpọ ihe ndị ahụ ụdị, lee na Template, na nke ọ bụla dị elu na nke dị elu tupu webpage na-enyefe onye ọrụ ahụ.

Ihe nlere bụ koodu na-echekwa ozi na nchekwa data maka nlaghachị, ụdị na ịsụgharị.

Nlele na-ekpebi otú e si mepụta ihe nlereanya ahụ, na-ejikwa ya, ihe fọrọ nke nta ka ọ bụrụ, ọ fọrọ nke nta ka ọ bụrụ nlele niile ga-eji nlereanya ozugbo.

Template bụ koodu HTML na ụfọdụ mgbịrịgba mgbakwunye na whistles a na-akpọ asụsụ Template. A na-ekwupụta ndebiri ebe ọ na-ejupụta koodu Python na onodu ya dị ka ụdị na ozi (iji eriri na nhọrọ) site na nlele.

Django nwere ihe ndị ọzọ mejupụtara, gụnyere ma ọ bụghị naanị:

Ntọala, nke na-ahazi ngwa ahụ ka anyị tụlere.

URL, nke bụ usoro nke onye ọrụ na-agbaso iji nweta akụkụ ụfọdụ nke ngwa Weebụ.

Formsdị, nke na-akọwapụta etu ozi si ziga na sava ahụ ma rụọ ọrụ nchekwa data yana onye ọrụ. Ihe ndị a bụ ntọala nke nhazi ozi na akụkụ nkesa, ma nwee ike ịnabata ụdị ozi ọ bụla na kọmputa, ọtụtụ atụmatụ ederede, na ezigbo Booleans / Boolexs).

Ndebiri, nke bụ koodu ndepụta na asụsụ ndebiri ma nwee ike ịnwe ozi dị ka websaịtị ma bara uru maka ihe nkesa ahụ.

Furtic faịlụ, nke na-abụkarị Javascript na ọbá akwụkwọ nke sava ahụ na-eje ozi ma jikọta ya na ndebiri.

Faịlụ mgbasa ozi, nke sava ahụ na-eje ozi ma ọ bụ na-ahazi ya na sava ahụ tupu a hazie ya na sava ọzọ (bọket) maka Bochum.

Middle, nke bụ mpempe koodu na-agba otu oge dị ka echiche ọ bụla ma na-atụle "gụnyere" n'echiche.

Ndị na-eso ụzọ, nke ha na-ahazi onodu nke oge ọ bụla ma jiri ya tinyekwuo ya.

Ule, nke gosipụtara na onye ọrụ ma ọ bụ arịrịọ gafere ụfọdụ ihe achọrọ tupu e mee ka echiche a.

Ndị na-ere ahịa, nke na-ekwu etu esi emesi web webvicets ma zaghachi na nkwukọrịta.

Admin, nke a na-eji edebanye aha na ụdị ya mere enwere ike ijikọ ya na nkọwa zuru ezu n'ime ibe Django, ebe nchekwa data nwere ike ịkpụzi site na ntinye data.

Celery, nke na-akọwapụta akụkụ Asynchronous akụkụ nke koodu DJANGGO nwere ike ịmalite ịgba ọsọ tupu ịmalite ozugbo na ọrụ ọzọ ma ọ bụ akara koodu ọzọ.

Django nwere ike inwe ọtụtụ ihe ndị ọzọ, nke anyị ga-atụle n'ụzọ zuru ezu ebe a. Enwere ọtụtụ ụzọ iji mee ka ọ dị mma, nke na-agbakwunye webkocts, nke na-agbakwunye ngwanrọ nke ndị ọzọ, na-egbu ọrụ ndị ọzọ, ebe ọtụtụ koodu gburu. Nlele bụ igodo n'ihi na ha na-ekwupụtakarị koodu koodu niile akọwapụtara nke ọma usoro URL, ma ọ bụ ngalaba nke sava ahụ.

Ka anyị buru ụzọ nyochaa ọrụ. Nlele na-amalite na mbubata koodu nke a ga-eji ya eme ihe, ma kọwaa iji nkọwapụta ọrụ ma ọ bụ klaasị ọrụ. A na-akọwa echiche dị mfe site na ọrụ ọrụ a na-akọwa, ma weghachi HTTPRONSCONSON na ndebiri. Ka anyị bido site na ịkọwapụta echiche dị mkpa iji weghachi ederede "Ndewo ụwa". Cheta na oge ọ bụla ị tinye koodu mgbe nkwupụta dị ka è, ọ bụrụ na, mgbe, ị ga-etinye oghere maka nkọwa nke ọ bụla ị ga - achọ itinye n'ọrụ gị. Anyị ga-abanye n'ime ihe ndị a pụtara n'oge adịghị anya.

Site na ndekọ saịtị anyị, Dezie ndepụta / ilele faịlụ.py ma tinye ahịrị ndị a na njedebe nke faịlụ ahụ.

from django.http import HttpResponse

def hello(request):
    return HttpResponse('hello world')

Hjango's HTTPRPONCon na-emeghachi omume na eriri ederede, na-egosi na oghere na mmechi '. Oge ọ bụla ị ga-enyefe ozi gaa na ọrụ ma ọ bụ klaasị, dị ka arịrịọ ma ọ bụ eriri, ị ga-eji nne na nna (, na-emeghe na mmechi).

Nke a abụghị naanị ihe anyị kwesịrị ịhụ anya anyị. N'ezie, anyị agwaghị ihe nkesa ahụ ebe echiche dị, anyị ka kwesịrị ịkọwa otu ụzọ ele echiche kwesịrị ikwupụta otu ụzọ. Ka anyị bido site na ịkọwa ụzọ dị mkpa na ngwa / URLs.py, anyị ga-abanye n'ime otu otu.

Na ngwa / URLS.py, tinye ahịrị mgbe nkwupụta mbubata mgbe mmalite mbubata ekiri anyị ka ekepụtara.

from feed import views as feed_views

Ugbu a, ka anyị kọwaa usoro nlereanya. Echiche dị iche iche nwere ihe atọ, nke na-ekwupụta ihe nkesa dị na sava ahụ, ọ dị mfe iji weghachite ma ọ bụrụ na ọ dị mkpa iji mee ohere maka echiche ọzọ ma ọ bụ na-aga n'ihu. Ọ bụ ihe ezi uche dị na ya ime ihe a ma na-agbanwe agbanwe, n'ihi na koodu koodu gị ga-abụ ebe obibi na-agbanwe agbanwe nke chọrọ mgbanwe na ịdị mfe iji rụọ ọrụ. Nke a bụ ihe nlere gị ga-adị, ịnwere ike ịgbakwunye nke a na Urlparterns = [ngalaba nke ngwa / URLs.py. A na-akọwa usoro nlele ahụ na ihe atọ a kọwara n'elu, ọrụ akpọrọ ụzọ. Usoro URL gị bụ ndepụta, yabụ jide n'aka na ị ga-akwụsị ihe ọ bụla n'ime ha mgbe niile, n'ihi na nke a na-ekewa nke ọ bụla. Ihe ọ bụla ga-aga na ahịrị ọhụrụ, ọzọ na oghere anọ tupu ya emee, dị ka ngwa ahụ na ntọala.py. Anyị ga-akọwapụta mpaghara mbụ nke echiche ya na ọrụ eriri efu, iji mepụta nlele na-aga na ntọala ntọala nke sava weebụ. URLS gị.py kwesịrị ịdị ka nke a:

from feed import views as feed_views

urlpatterns = [
    path('', feed_views.hello, name='hello'),
]

Nke a bụ ntọala maka ịmepụta weebụsaịtị na DJango nke bụ Static kpamkpam. Iji mee ka ebe nrụọrụ weebụ dị omimi karị ebe anyị nwere ike ịmalite ozi nlegharị anya, dị ka onyonyo, vidiyo, anyị kwesịrị iji ụdị, nke anyị ga-achọpụta na-esote. Maka ugbu a, ka anyị lelee koodu anyị ma gbaa sava ahụ. Iji lelee koodu maka njehie, ọsọ:

python manage.py check

Ọ bụrụ na enwere ozi njehie ọ bụla, ị ga-eji nlezianya nyochaa mgbanwe ndị ị mere na ngwa gị ma hụ ma ọ bụrụ na enwere oghere, agwa ọ bụla, ma ọ bụ ihe ọ bụla. Ọgụgụ site na ozi njehie (ọ bụrụ na ịnwere otu), ị ga-enwe ike ịhụ ụzọ na faịlụ ị mepụtara ma ọ bụ dezie nọmba ahịrị, yabụ lee ma hụ ma ị nwere ike idozi ihe ọ bụla dị. Ọ bụrụ na ịhazigharị okwu ahụ, mee iwu a dị n'elu. Mgbe sọftụwia gị dị njikere ịgba ọsọ ma na-arụ ọrụ, ị ga-ahụpụta nsonaazụ "nlele akọwapụtaghị okwu ọ bụla." Ugbu a ị dịla njikere ịga. Gbaa sava ahụ na:

python manage.py runserver 0.0.0.0:8000

Ugbu a mepee ihe nchọgharị weebụ na ịnyagharịa na http: // localhost: 8000. Shouldkwesịrị ihu ederede ahụ weghachiri na nne na nna na nkwupụta nke ọrụ HTTPRPTONONCONE N'ALA. Nke a bụ naanị ihe atụ bụ isi, mana ọ bụrụ na i mere ya ebe a, ị ghọtara ntọala nke otu Linux, Bishọn, Python, na Django Ọrụ. Ka anyị gwuo ala n'ime usoro nchekwa data, ma nyochaa ike nke klas nke Python na ịchekwa ozi. Mgbe ahụ, anyị ga-amalite iji nweta HTML na CSS tupu anyị emee saịtị anyị zuru oke, na-agbanwe ma nwee nchekwa nke Javascript na igwe.

A na-echekwa klas na ụdị.py nke ngwa gị. Iji Nano, Dezie ngwa / Models.py ma tinye klas ọhụrụ. A na-akọwa klaasị na nkọwa klaasị ma na-agafe superclass na ọ ketara site na, na nke a models.Model. Aha klas ahụ na-abịa mgbe nkọwa klas ahụ, a na-ejikarị akwụkwọ akụkọ: (Cope), tupu agwakọta ya, tupu àgwà na nkọwapụta ndị e kekọtara na klas ahụ n'okpuru. Klas anyị chọrọ ID anyị nwere ike iji weghachite ya ma debe ya pụrụ iche, ọ chọkwara akụkụ ederede iji chekwaa ụfọdụ ozi iji chekwaa ụfọdụ ozi iji chekwaa ụfọdụ ozi iji chekwaa ụfọdụ ozi iji chekwaa ụfọdụ ozi iji chekwaa ụfọdụ ozi iji chekwaa ụfọdụ ozi iji chekwaa ụfọdụ ozi iji chekwaa ụfọdụ ozi iji chekwaa ozi ụfọdụ. Mgbe e mesịrị na anyị nwere ike itinye oge, faịlụ, ezigbo ma ọ bụ ụgha ma ọ bụ ụgha nke nwere ike inyere koodu anyị aka, ihe atụ iji mee ihe nlereanya na sava ahụ, na ndị ọzọ. Ka anyị wepu koodu dị n'okpuru:

from django.db import models # Bubata nke eji akọwa klas anyị na ọ bụ njirimara
class Post(models.Model): # Nkọwa nke klas anyị n'onwe ya
    id = models.AutoField(primary_key=True) # NJ nke ihe nlereanya anyị, igodo doro anya na-akpaghị aka na-ekwe ka anyị ga-ajụ anyị ajụjụ, debe ya pụrụ iche, ma ọ bara uru mgbe anyị kere ya ozugbo.
    text = models.TextField(default='') # Ihe omuma anyi ulo akwukwo, na nke a, ederede ụfọdụ, ndabara na eriri efu.

Mechie ma chekwaa faịlị ka anyị mere tupu imechaa.

Enwere ọtụtụ ubi ndị ọzọ na nhọrọ anyị ga-enyocha mgbe anyị na-emelite klaasị a dịka ngwa anyị na-apụta, mana nke a bụ ihe ndị dị mkpa nke ịmepụta ngwa iji bipu ederede. Agbanyeghị, ihe nlereanya a agaghị arụ ọrụ naanị. Dị ka akọwara na mbụ, anyị ga-achọ nlele ọdịnala na URL ọdịnala iji mee ọrụ nlereanya a, anyị ga-achọkwa ụdị ya na ndebiri. Ka anyi jiri uzọ mbu.

Iji kọwaa ụdị, dezie ngwa / Formdị.py na Nano ma tinye ahịrị ndị a. Anyị ga-achọ mbubata abụọ, ụlọ akwụkwọ anyị, yana ihe nlereanya anyị mepụtara (ndepụta. Formdị nwekwara ike ịnwe ọrụ mbido nke setịpụrụ ya dabere na ozi na arịrịọ ahụ, ihe atụ ma ọ bụ ihe ọzọ, anyị ga-achọpụta na mgbe nke ahụ gasịrị.

Formdị ihe nlereanya dị oke uru n'ihi na ha nwere ike ịmepụta ihe nlere ma ọ bụ dezie ihe nlereanya, yabụ anyị ga-eji ha eme ihe. Ka anyị kọwaa otu n'ime usoro.py dị n'okpuru.

from django import forms
from feed.models import Post

class PostForm(forms.ModelForm):
    text = forms.CharField(widget=forms.Textarea)
    class Meta:
        model = Post
        fields = ('text',)

Nke a bụ ntọala nke ụdị ụdị na ihe nlereanya dị ka. Enwere ike iji ụdị ihe nlereanya a iji mee ka ọ dị ma ọ bụ dezie post, na-agbanwe ederede ya nwere. Anyị ga-elebanye anya na-ejikọ ụdị a na echiche na-esote. Ka anyị burugodị, ka anyị mee ndị ngagharị ma kwaga ebe nchekwa data ahụ ka koodu anyị nwere ike iso ihe nlereanya ahụ mgbe ọ na-aga. Iji mee nke a, gbaa iwu ndị a:

python manage.py makemigrations
python manage.py migrate

Nke a ga-ewe oge iji mezuo, mana ozugbo ọ na-eme, ọ ga - enyere gị aka ịnweta ihe nlereanya ahụ na echiche, etiti, ma ọ bụ ebe ọzọ na sọftụ. Ka anyị gaa n'ihu na-ele ebe anyị ga-ahụ ụdị ihe a. Dezie nri / ilele.py ma tinye koodu na-eso ya, dika ekwuru. Gaghị etinye ihe ọ bụla mgbe ihe ịrịba ama, koodu ahụ bụ nkwupụta ndị a na-eji kọwaa ozi gbasara koodu ahụ. Anyị ga-amalite site na ibubata ihe nlereanya anyị na echiche, ma na-agbakwunye ya ebe anyị nwere ike inye ya na ndebiri dịka ndepụta. Na-esote, anyị ga-agbakwunye ndebiri ebe anyị nwere ike ịlete mpempe akwụkwọ ahụ na ihe nlereanya iji mepụta ihe ọhụrụ dabere na sava ahụ wee biputere ya na sava ahụ. Nke a dị ka ihe gbagwojuru anya, yabụ ka anyị were ya na nzọụkwụ. Tupu anyị emechaa echiche ahụ, ka anyị mepụta ndebiri nke na-agbagharị ihe nlereanya ahụ ma jide n'aka na anyị nwere ike ịhụ ya site na ịmepụta post ọhụrụ na shei. Nke a bụ otu esi ele anya na:

    posts = Post.objects.all() # Gbaa niile posts na nchekwa data ruo ugbu a

Ihe a niile mara mma nke dị mfe ruo mgbe anyị rutere n'ala. Ọ na-enye uru site na ọrụ HTTP dị ka ihe atụ nke HTTP dị ka ihe atụ ndị mbụ, na-anabata ihe omume mbụ ya, ma na-anabata ndebiri ahụ akọwapụtara na ọrụ ahụ. Ihe ndebiri ahụ ga-abụ akwụkwọ otu asụsụ a na-akpọ Jiinja2, nke na-atụgharị ozi Python n'ime HTML.

Iji malite imepụta ndebiri, mee ndekọ abụọ na nri.

mkdir feed/templates
mkdir feed/templates/feed

Ọzọ, dezie ndebiri na ndekọ ahụ dị n'elu, ndepụta / Templates / ndepụta, na ịgbakwunye koodu maka ihe atụ a. Ka anyị leba anya n'ihe atụ a.

Nke a bụ ndebiri dị mfe. Ọ na-akọwa oghere na imechi mkpado HTML, mkpado akwụkwọ, akara aka nwere aha akụkọ, yana akara nke na-agbakwunye ọ bụla post na ndepụta nke posts dị ka paragraf na Template. Nke a bụ ihe ọ na - ewe iji dengs posts, mana ọ nweghị onye nọ na nchekwa data. Ka anyị mepụta ụfọdụ na shei. Anyị nwere ike ịgba shei ahụ na-ejikwa.py

python manage.py shell

Ugbu a, ka ebubata ihe nlereanya anyị

from feed.models import Post

Ọzọ, anyị ga-emepụta post dị mfe na eriri ma pụọ ​​shei. Eriri ahụ nwere ike ịbụ ihe ọ bụla, ogologo oge ọ bara uru ederede.

Post.objects.create(text='hello world')
exit()

N'ikpeazụ, anyị kwesịrị ịgbakwunye usoro URL na ndepụta anyị. N'ihi na ngwa nri anyị ga-eji ọtụtụ URL ọtụtụ, anyị chọrọ idobe nha faịlụ, ka anyị mepụta Urls.py na ngwa nri anyị dị ka nke a:

from django.urls import path
from . import views

urlpatterns = [
    path('', views.feed, name='feed'),
]

Anyị ga-edibe URLs.py na isi ngwa, ihe ọ bụla anyị kpebiri ịkpọ ya, nke a bụ ihe mbụ anyị kere. Dezie ngwa / ngwa.py ma tinye ihe ndị a na usoro URL

from django.urls import include # N'elu elu
    # ... Ebugharị gara aga ebe a

Ugbu a, mgbe anyị na-eji Python jikwaa ihe ndị ahụ. Na-esote, ka anyị mejupụta ụdị anyị kere ma bido ikepụta posts nke anyị. Ma tupu anyị dee ọtụtụ koodu, ka anyị mee nkwado ndabere site na iji edemede anyị dere na mbụ, ndabere. Gbaa edemede a na shei ahụ, chere oge ole na ole, a ga-akwado ya na koodu a na-edebe akwụkwọ GI.

backup

Mejuputa mpempe akwụkwọ dịtụ mfe. Anyị ga-ebubata mpempe akwụkwọ anyị, tinye akwụkwọ arịrịọ postler na elele, ma chekwaa post dị na ebe nchekwa data tupu ị na-ebugharị otu echiche ahụ. Anyị nwere ike iji ọrụ redirect, na ọrụ ọzọ a na-akpọ ntụgharị iji nweta URL maka usoro nlele. Anyị ga-ajụ nke a na ndepụta eriri: ndepụta 'n'ihi na aha usoro nke gụnyere, a na-akpọkwa echiche ahụ nri.

    posts = Post.objects.all() # Gbaa niile posts na nchekwa data ruo ugbu a
    if request.method == 'POST': # Ijikwa arịrịọ post
        form = PostForm(request.POST) # Mepụta ihe atụ nke mpempe akwụkwọ ma chekwaa data na ya
        if form.is_valid(): # Gosiputa ụdị
            form.save() # Chekwaa ihe ohuru
        return redirect(reverse('feed:feed')) # Redirect na otu URL na-enweta arịrịọ
        'form': PostForm(), # Gbaa mbọ hụ na ị ga-agafe n'ụdị ahụ n'ọnọdụ ahụ ka anyị nwee ike ịza ya.

Ugbu a, anyị ga-emelite Template ka ị nweta akaụntụ maka ụdị ọhụrụ. Anyị nwere ike ime nke a site na iji

Kpido na HTML na nsụgharị ahụ na Template bọtịnụ HTML. Anyị ga-achọ akara CSRF, ihe mgbaaka nke na-egbochi saịtị mpụga site na-eziga n'ụdị na-enweghị mbu ibupute peeji.

Ka anyị mebie nke a. Enwere klaasị ọhụụ, ihe akaebe, mpempe akwụkwọ, na bọtịnụ nyefere. Mara mma, mana mgbe anyị lere ya anya, anyị nwere ike ịchọ ka ọ dị mma. Ọ na-arụ ọrụ, anyị nwere ike biputere posts ọhụrụ na mpempe akwụkwọ ma zọpụta ha ugbu a na nchekwa data. Enwere ihe ole na ole na-aga ebe a. Anyị na-eji mkpado HTML Kwuwapụta na akwụkwọ bụ akwụkwọ HTML, anyị na-eji template tag ({% ...%, {...}} {...}}} {...}} {...} { Anyị nwekwara akaghị aka iji nyefee ederede site na iji mkpado na-egbochi ya na mkpado ndebiri. Mkpado na-egbochi mkpado dị ezigbo mkpa n'ihi na anyị nwere ike ịkọwa otu akụkụ nke ndebiri nke ha, na ndetu na template bụ ntọala nke otu anyị si tinye ngbanwe na koodu anyị.

Ugbu a, anyị kwesịrị ime ka ngwa anyị dị mma, n'ihi na ugbu a ọ na-adị mkpa. Anyị nwere ike ime nke a site na iji CSS, ma ọ bụ na klaasị kegidere ihe ọ bụla na akwụkwọ ahụ. CSS dị mma n'ezie n'ihi na ọ na-akọ ihe niile dị na peeji a, ma nwee ike ịdị mma nke ọma. Enwere ọbá akwụkwọ ole na ole nke nwere ike ime nke a, mana nke onwe m gara Bootap.

Bootstap nwere ike ibudata site na weebụsaịtị ha,Retbootstrap.com/. Ozugbo, pịa bọtịnụ ka ịgụọ nrụnye dops, ma detuo koodu site na ngalaba gụnyere site na ngalaba CDN. Ga-achọ koodu a n'elu akwụkwọ akwụkwọ HTML gị, na mkpado akpọrọ isi. Ọzọkwa, ka anyị gazie ma mepụta ndetute ntọala ka anyị ghara imegharị njikọ ndị a na ndebiri ọ bụla.

Mee ndekọ ndekọ ọhụrụ a na-akpọ ndebiri na ndebiri MKDIR, wee dezie ndebiri / Bara.html.

Ọ kwesịrị ịdị ka nke a:

Gbaa mbọ hụ ka ịpịakọta CSS na Javascript, The .CS na .js faịlụ, n'ihi na anyị ga-achọ ka saịtị anyị rụọ ọrụ n'ọdịnihu.

Ugbu a, ka anyị laghachi azụ shei ma gbaa iwu ngwa ngwa. Cheta, ọ bụrụ na ọ dị gị mkpa ịnweta ebe obibi nke mebere, pịnye ike Venv / Bin / rụọ ọrụ. Nke a ga - ahapụ gị ka ịwụnye ngwugwu Python n'obodo n'ụzọ na - eme ka DJANGO nweta ha. Iji nye ụdị anyị site na klaasị DJANGO Bootntap, anyị ga-eji ngwugwu Python na-akpọ ụdị crispy. Anyị nwere ike ibudata nke a na iwu a

pip install django-crispy-forms

Ozugbo etinyere nke a, tinye ya na ntọala.py

    # ... Ebugharị gara aga ebe a

Ugbu a, azụ na ndepụta nri anyị, anyị nwere ike iwepu ihe ụfọdụ. Ka anyị wepụ mmalite na njedebe nke akwụkwọ ahụ ma dochie ya nketa site na ndebiri anyị, na-eji ịgbatị na ngọngọ. Ọzọkwa, anyị ga-etinye ibubata ndenye ihe ndebiri na ibu na nzacha ndebiri na ụdị. N'ikpeazụ, ka anyị tinye klaasị bootstrap na bọtịnụ iji mee ka ọ dị ka bọtịnụ. Nke ahụ kwesịrị ịdị ka nke a:

Mara mma! Nke ahụ bụ ntakịrị koodu ugbua. Ọzọ, anyị kwesịrị nwalee ya ma jide n'aka na anyị hụrụ na ihe ọ bụla dị mma, ma nweekwa n'aka na ihe niile na-arụ ọrụ nke ọma. Gbaa sava ahụ dịka ntuziaka gara aga ma gbaa mbọ hụ na saịtị ahụ na-arụ ọrụ na-arụ ọrụ. Nnukwu ọrụ! Just dị njikere ịga n'ihu na usoro ọzọ, nke anyị ga-etinye ọrụ nbanye na-arụ ọrụ iji URL nke ndị yiri ya, ụdị, echiche ya na ndebiri. Template ntọala dị mkpa, anyị ga na-agbanwe ya ma mee mgbanwe dị ka achọrọ, ma mechaa, ozi ndị ọzọ dị mkpa ịbanye na akaụntụ gị na akaụntụ gị nwere ike ịnweta.

Iji mee nke a, anyị ga-eji onye ọrụ rụọ ọrụ n'ime DJANGO. Ihe nlere nke onye ọrụ bụ ihe nlereanya nchekwa data, dị ka post anyị, enwere ike ịsụgharị iji banye onye ọrụ na weebụsaịtị. N'ọdịnihu, tupu anyị etinye saịtị ahụ na Internetntanetị, anyị ga-agbasa ụdị ihe nlereanya a na ụdị ndị ọzọ a gwara ya, ma wuo usoro nchekwa ndị ọzọ maka nbanye ahụ na-eguzogide phishing. Anyị ga-ebido site na iji ụfọdụ e wuru na nbanye nbanye nke Django na-enye. Nke mbu, ka anyi meputa ngwa ohuru nke anyi ga - eji nye ndebiri na echiche maka ibe nbanye. Anyị ga-ekepụta ngwa ndị ọzọ ka ọ na-anọchite anya ngwa ahụ iji chekwaa ngwa ahụ, na-anọchite anya nkwukọrịta ozi ubi, na-esote nyocha, ọtụtụ ihe ngosipụta, na nkwado akara aka.

Anyị ekwuola banyere ịmalite ngwa. Site na ndekọ anyị, n'ime ihe dị mma, On Passsion Jikwaa.py ndị a arụmụka

python manage.py startapp users

Ugbu a, anyị kwesịrị inwe ndekọ maka ngwa ọhụrụ. Ka anyị bido site na ịmepụta echiche na ndekọ ahụ dabara na nbanye onye ọrụ. DJango emeela ka elele maka logins ndị ọrụ, mana ihe ndị a agaghị adị mma maka anyị n'ihi na anyị chọrọ nlele aha, nke bụ nke ọma ịmecha ya na nkọwa.

Na nlele a, anyị ga-amalite site na ịlele maka arịrịọ arịrịọ, na-aga n'ihu. A na-enyocha akaụntụ nnabata sitere na DJANGO, ma banye na onye ọrụ tupu ị na-emegharị ha na ngwa nri anyị.

Na ndị ọrụ / nlele.py, tinye koodu a

        username = request.POST['username'] # Nweta aha njirimara na paswọọdụ sitere na arịrịọ post
        password = request.POST['password'] # Nyochaa onye ọrụ ahụ

Nke a bụ ihe ị chọrọ maka nlele nbanye. Ugbu a, ka anyị mepụta ụdị maka echiche site na ịgbatị ntọala ntọala. Anyị ga-amalite site na ịmepụta ndekọ ọhụrụ maka ndebiri na folda ndị ọrụ.

mkdir users/templates
mkdir users/templates/users

Ugbu a, anyị kwesịrị inwe ike idezi ndị ọrụ / Templates / ndị ọrụ / nbanye.html. Mgbe anyị nọ na ya, anyị ga-emepụta ndebiri iji nye onye ọrụ ka ọ bịanye aka.

nano users/templates/users/login.html

Ugbu a, na Template,

Nke a bụ ntọala nke ndebiri. Ọ bụ n'ezie dị ka ndebiri nke ọzọ na nhazi nke ihe owuwu, mana ọ dị ntakịrị ntakịrị ihe dị iche ma ọ bụrụ na a sụgharịa ya. Anyị nwere ike idetuo koodu a iji wuo ndebiri ọzọ a na-akpọ ndị na-edebanye aha.html, ebe anyị ga-agbanwe okwu ma jiri mpempe ọhụrụ anyị na-ewuli ya. Ka anyị mee usoro ndebiri. Dezie ndị ọrụ / Templates / ndị ọrụ / denye aha.html ma tinye koodu a:

Ugbu a, ka anyị wuo otu ụdị maka ndebanye aha anyị ma na-agagharị na echiche tupu anyị bulie onye ọrụ anyị na ihe nlereanya. Anyị ga-eme ụdị a iji bido, ma tinyekwuo nkọwa na atụmatụ nchekwa dịka nkwekọrịta na captcha n'ọdịnihu. Dezie mpempe akwụkwọ na ndị ọrụ Nano / Formdị.py, ma tinye koodu a.

from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm

class UserRegisterForm(UserCreationForm):
    email = forms.EmailField()

    class Meta:
        model = User
        fields = ['username', 'email', 'password1', 'password2']

Yabụ na anyị nwere mpempe ọzọ ebe a, nke na-arụ ọrụ n'ụzọ ziri ezi. Ọ bụ otu onye ọrụ na aha njirimara, email na paswọọdụ, yana nkwenye ndepụta paswọọdụ. Rịba ama na ụdị a anaghị agbatị klas mgbe niile, ọ bụ ụdị ihe nlereanya pụtara na ọ nwere meta. A kọwara otu ubi ka ọ bụrụ otu, na klaasị na-akọwapụta ihe nlereanya ụdị ahụ kwekọrọ na ozi a ga-ede n'ụdị. Imirikiti nke a adịlarị na Django wuru na onye ọrụ, yabụ anyị ga-eji nke ahụ bụ ntọala maka klaasị (gafere na nne na nna).

Ọzọ, anyị ga-eleba anya na echiche ịdebanye aha onye ọrụ, ugbu a anyị nwere mpempe na ndebiri. Nke a bụ ihe nlereanya, dị ka nke dị na nlele ọhụrụ. Dezie ndị ọrụ / nlele.py ma tinye koodu a:

# ... mbubata

Nke a bụ ihe anyị kwesịrị iji nweta onye ọrụ aha, mana anyị kwesịrị inwe ọtụtụ ozi. Anyị chọrọ ịmata oge onye ọrụ debara aha ya na saịtị ahụ, ụfọdụ ozi gbasara ha, anyị ga-emelite ụdị ndepụta anyị, post, ka ị nweta akaụntụ onye ọrụ na njirimara ya. Iji mee nke ahụ, anyị ga-emelite ụdị.py na ngwa abụọ ahụ. Ka anyị bido site na ịdezi ụdị nri. Ọ kwesịrị ịdị ka nke a:

from django.db import models # ... mbubata
    author = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True, related_name='posts') # Tinye n'ahịrị a

Lezienụ anya na ahịrị nke abụọ nke etinyere na faịlụ ahụ. Nke a bụ igodo mba ọzọ, nke ga-ekwupụta post ọ bụla ruo otu onye ọrụ n'otu post, yabụ anyị nwere ike ijide n'aka na enweghị ike ịme ya na ọ bụghị post ọ bụla na-enweghị mmasị na ya na onye ọrụ. Anyị na-akọwapụta igodo mba ofesi a na klaasị ọ na-anọchi anya, arụmụka iji hụ na ọ dị mkpa, ma nwee ike ijide ya, na aha anyị nwere ike iji zoo aka na ihe ndekọ ahụ na-emepụta. Aha a metụtara, n'adịghị ka post.auttor, onye ode akwụkwọ nke post, na-enye anyị onye ọrụ nke bipụtara post ahụ n'onwe ya. Anyị nwere ike nweta posts onye ọrụ mere site na ịgba ọsọ onye ọrụ.posts.als (), ma ọ bụ onye edemede.Pals.all ().

Ugbu a, ka anyị mee ka logins anyị karị. Anyị nwere ike ugbua mee ka saịtị anyị dị obere karịa na-enweghị atụ na-egbochi ọnụ ọgụgụ oge anyị ga-enye ohere nbanye na saịtị ahụ, nke a dị mfe. Ka anyị bido ịchekwa ụfọdụ ozi gbasara onye ọrụ ọ bụla tupu mgbe anyị na-agalite ngwa anyị. Edezi ndị ọrụ / Models.py, tinye koodu a.

from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone

class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, null=True, blank=True, related_name='profile')
    account_created = models.DateTimeField(default=timezone.now)
    last_seen = models.DateTimeField(default=timezone.now)
    can_login = models.DateTimeField(default=timezone.now)
    preferred_name = models.CharField(max_length=20,default='', null=True, blank=True)
    bio = models.TextField(blank=True, default='')

Rịba ama na ihe nlereanya a dị ezigbo mma maka ihe nlereanya post. Anyị nwere ndị ọzọ ibubata, oge, nke ga - enyere anyị aka ịtọ ntọala na nri ubi, anyị nwekwara agwa ọma na ederede. Iji oge ndị a na-enyere anyị aka ịchekwa saịtị ahụ ma ghọta ihe ya, na ederede ederede ka anyị nyeghachi ozi gbasara onye ọrụ ọ bụla, ma ọ bụ onye edemede, na weebụsaịtị. Onetonefield kwesịrị ịbụ naanị obere nchebara echiche, ọ na-akpa àgwà otu ihe ahụ dị ka onye na-ahụ maka ihe nlereanya. N'ụzọ dị otú a, onye ọrụ nwere otu profaịlụ, ebe ha nwere ike ịnwe ọtụtụ posts.

Ugbu a, ka anyị meziwanye nbanye anyị na ịdebanye aha maka profaịlụ. Nke mbu, dezie ndị ọrụ / echiche.py na elekwasị anya na ịdebanye aha:

# ... mbubata
            Profile.objects.create(user=user) # Gbalịsie ike ịgbakwunye ahịrị a, iji mepụta profaịlụ maka onye ọrụ

Nke a na - emepụta profaịlụ maka onye ọrụ, na - enweghị jupụta n'ihe ọmụma ọ bụla. Ugbu a, anyị chọrọ ijide n'aka na enweghị ike ịbanye na akaụntụ onye ọrụ ya ọtụtụ mgbe, ma ọ bụ opekata mpe okwuntughe ugboro ugboro, yabụ ka anyị melite nbanye nyocha.

# ... mbubata
        if user and user.profile.can_login < timezone.now(): # Mara na anyị na-enyocha ma ọ bụrụ na onye ọrụ nwere ike ịbanye
        else: # Ọ bụrụ na nbanye ahụ enweghị ihe ịga nke ọma,
            user = User.objects.filter(username=username).first() # Nke a bụ akụkụ ebe anyị na-emelite profaịlụ ndị ọrụ
                profile.can_login = timezone.now() + datetime.timedelta(seconds=15) # Ya mere ha enweghị ike ịbanye na sekọnd ole na ole

Nke a bụ ihe dị mkpa nke nchekwa. Gbaa mbọ hụ na saịtị ahụ adịghị ka mmadụ na-achọ naanị njikọ paswọọdụ ọ bụla, ma ọ bụ ole na ole n'ime ha. Nke a agaghị enwe nkụda mmụọ onye nkịtị maara passcode ha ma na-abanye na ngwaọrụ ole na ole, mana ọ ga-edobe ọtụtụ robots phing site na ngwa. Rịba ama na anyị agbakwunyere ma ọ bụrụ na nkwupụta na agbanwe, can_login, nke ahụ kwesịrị ịbụ oge gara aga, ma melite ya na nbanye ọ bụla na-enweghị isi na-eji otu aha njirimara. N'ụzọ dị otú a, onye na-eme obi ike agaghị enwe ike iche paswọọdụ ebe ọ bụla dị nso. Onu ogugu nke sekọnd. M na-akwado 15 ka m malite.

Cheta, anyị wuru ederede ndabere iji chekwaa ọrụ anyị, yabụ ka anyị gaa n'ihu na nkwado ndabere nke ihe anyị nwere ruo mgbe anyị nwere ihe niile echekwara. Gbaa iwu:

sudo backup

Ọzọkwa, nke a ga-echekwa ọrụ gị ruo ugbu a. M na-akwado ịgbanye nkwado ndabere ugboro ugboro iji chekwaa ọrụ gị, ma ị nwere ike ịchọ ịgba ọrụ nkwado na-akpaghị aka. You nwere ike iji uru Uniịm mee nke a. Iji mee ka ike a rụọ ọrụ, mee iwu a ma tinye paswọọdụ gị:

sudo crontab -e

Ọ bụrụ na ịchọbeghị nhọrọ 1 maka Nano, onye nchịkọta akụkọ ị ga-amatarịrị, ma pịgharịa gaa na ala nke ihe eji akụ. Tinye ahịrị ndị a:

0 * * * * sudo backup

Cron na-eji usoro ahụ, oge, ụbọchị ọnwa, ụbọchị izu, ụbọchị izu, ebe ọ na-anọchite anya iwu ahụ. Iji 0 maka nkeji na * maka ndị ọzọ nhọrọ ndị ọzọ, anyị nwere ike ịgbanye iwu na mbu nke mbụ nke elekere ọ bụla na mmalite nke nkeji. Nke a na-enye anyị ohere ịkwado koodu na akpaghị aka. Ọrụ niile nke Cron mgbe a na-egbu ya na SUD na-agba ọsọ dị ka mgbọrọgwụ, yabụ anyị agaghị pịnye na paswọọdụ kwa elekere.

Iji mee ka ọ dịrị gị mfe ịkwado koodu anyị n'emeghị paswọọdụ, ka anyị gbanyụọ paswọọdụ maka iwu nkwado anyị. Anyị ga-eme nke a site na igbu iwu a na ịbanye paswọọdụ:

sudo visudo

Ugbu a, ka anyị pịgharịa gaa na ala nke faịlụ ahụ ma tinye ahịrị ọzọ:

ALL ALL=NOPASSWD: /bin/backup

Nke a na - eme ka anyị mee ka anyị gbaa iwu "nkwado ndabere" dịka onye ọrụ ọ bụla, na - enweghị paswọọdụ. Usoro maka nke a dị mfe, naanị mpịakọta ahịrị na "nopasswd: / bin /" ma kwụsị / bin / USR /.

Ugbu a, ka anyị bido ịrụ ọrụ na email. Email dị ezigbo mkpa maka weebụsaịtị, n'ihi na ọ bụ ụzọ ị ga-edebe webụsaịtị dịkwuo mma, nyochaa ndị na-arụ ọrụ bụ ezigbo mmadụ, na ngwaahịa ahịa ma ọ bụ ọrụ ndị ahịa. Ọtụtụ ndị mmadụ na-enyocha email ha kwa ụbọchị, ma na-anata ụdị email niile gbasara ngwaahịa na ọrụ ha nwere mmasị na ebe nrụọrụ weebụ Django, ma na-anabatakwa gị ị ga-ahọrọ gị nke ọma.

Nke mbu, inwere ike ịkwụ ụgwọ maka ọrụ email ga - enyere gị aka izipu ozi site na ngalaba gị ma chọrọ koodu pere mpe. Enwere ọtụtụ ọrụ na-enye nke a, dị ka Google Witchpace, zigala, Mailgun, na ndị ọzọ.

Ma ọ bụghị ya, ị na-ewepụ nke ọma ịrụ ọrụ email nke gị n'ime sava gị site na ọkọ. Ana m akwado nhọrọ a, n'agbanyeghi na ọ bụ koodu ọzọ ma nwee ike ịchọ Bochum pụrụ iche. Gaghị enwe ike ịmalite nkesa ozi site na kọmputa ụlọ gị nke ukwuu, yabụ ka anyị gaa nhazi nhazi na koodu iji zipu sava na igwe ojii ma mepụta sava ozi nke anyị n'ime.

Nke mbu, dezie ntọala.py na iwu a:

nano app/settings.py

Ebe ngwa bu aha ngwa i mepụtara na StappApp.

Tinye ahịrị ndị a:

SITE_NAME = 'Django App'

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_ADDRESS = username@server.com'
EMAIL_HOST_USER = 'username'
EMAIL_HOST_PASSWORD = config['EMAIL_HOST_PASSWORD']
DEFAULT_FROM_EMAIL = '{} <{}>'.format(SITE_NAME, EMAIL_HOST_USER)

Gbalịsie ike ịgbanwe ndị a mgbe ị dịla njikere itinye ngwa gị, anyị ga-atụgharị nke a mgbe e mesịrị. Ntọala email_adddress kwesịrị ịbụ email ị ga - achọ iziga, paswọọdụ (email_hostword) kwesịrị ịhazi maka sava ahụ. Ana m eburu paswọọdụ ahụ na faịlụ nzuzo iji mee ka o si na koodu ndị a, karịa ahịrị ndị a na ntọala.py:

import os
import json
with open('/etc/config.json') as config_file:
    config = json.load(config_file)

Mgbe ahụ, m guzobere faịlụ JSON na Config na /etc/ /etc/onfig.json iji Nano dị ka ndị a.

Iji dezie faịlụ a:

sudo nano /etc/config.json

Tinye ahịrị ndị a:

{
	"EMAIL_HOST_PASSWORD": "<some password here>"
}

Anyị ga-aga n'ihu dezie faịlụ Config ma tinye okwuntughe na igodo anyị ga-eji na ngwa. Ka ọ dị ugbu a, ka anyị nyochaa ngwa ngwa etu esi ezipu Email site na iji Python. Nke mbu, ka anyi mepụta ndebiri maka ozi nkwenye anyị nwere ike izigara ndị ọrụ anyị, tinye ya na ndekọ ndebiri onye ọrụ. A ga-ede ihe ndebiri a na HTML.

nano users/templates/users/verification_email.html

Email a dị mfe. Ọ na-ewere ọnọdụ nke onye ọrụ, URL ụlọ ọrụ maka saịtị ahụ, yana NJ onye ọrụ na ijikọ nke eji iji nyochaa email onye ọrụ. Gbalịsie ike ịkọwa URL URL na Ntọala.py tupu anyị dee ụfọdụ koodu Python iji nye Template. Gaa n'ihu tinye ahịrị ndị a na ngwa / ntọala.py, dị nso na mbido.

SITE_NAME = 'Django App'
PROTOCOL = 'https'
DOMAIN = 'example.com'

BASE_URL = PROTOCOL + '://' + DOMAIN

N'ikpeazụ, mgbe saịtị gị dị njikere maka ịntanetị ma ị ga - achọ ya, ị ga - achọ ịkọwa ngalaba gị dị ka ngalaba aha ị zụrụ na-anọchite anya saịtị ahụ. Nke a bụ aha ị ga - ede na Navbar iji nweta saịtị gị. Ka ọ dị ugbu a, ịnwere ike ịhapụ ngalaba ahụ ma ọ bụ jiri onye nwe ụlọ. Ga-achọ ịgbanwe saịtị ahụ, ị ​​chọrọ inye saịtị gị, nke ịhọrọ.

Tupu anyị ziga ozi email, ka anyị mepụta onye na-eme ihe nkiri ka anyị nwee ike ịmegharị akaụntụ akaụntụ na-agaghị agwụ. Anyị nwere ike ime nke a site na iwu na ibubata akaụntụ akaụntụ nke dị ka ihe ndị a. Dezie faịlụ a:

nano users/tokens.py

Tinye koodu a:

from django.contrib.auth.tokens import PasswordResetTokenGenerator
import six
class TokenGenerator(PasswordResetTokenGenerator):
    def _make_hash_value(self, user, timestamp):
        return (
            six.text_type(user.pk) + six.text_type(timestamp)
        )
account_activation_token = TokenGenerator()
unsubscribe_token = TokenGenerator()

Nke a bụ ihe ngosi nke ihe ngosi a bụ ihe akaebe na-ebute onye ọrụ anyị nwere ike izipu onye ọrụ na URL na onye ọrụ nwere ike iji nyochaa email ha ma mee ka akaụntụ ha rụọ ọrụ.

Na-esote, ka anyị hụ otu esi eziga email. Iji Nano, Dezie Ndị Ọrụ / Email.py.

nano users/email.py

Izipu nkwenye HTML ga-adị ka nke a:

from django.contrib.auth import get_user_model
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.utils.encoding import force_bytes
from django.core.mail import EmailMultiAlternatives
from django.shortcuts import render
from .tokens import account_activation_token
from django.template.loader import render_to_string
from django.utils.html import strip_tags
from django.template import Template, Context
from django.conf import settings
import traceback

def send_verification_email(user):
    User = get_user_model()
    mail_subject = '[{}] Activate your account.'.format(settings.SITE_NAME)
    html_message = render_to_string('users/verification_email.html', {
        'user': user,
        'domain': settings.DOMAIN,
        'protocol': 'https',
        'uid': urlsafe_base64_encode(force_bytes(user.pk)),
        'token': account_activation_token.make_token(user),
    })
    send_html_email(user, mail_subject, html_message)

Nke a dị mfe. Anyị na-ebubata ọrụ anyị kwesịrị izipu ozi ahụ, na ndebiri, yana ntọala anyị, anyị na-akọwapụta email site na iji ọrụ. Ị ga-achọpụta na anyị akọwapụtaghị ọrụ ka izipu ozi, ziga_htmll_email, yabụ ka anyị dee nke a n'okpuru koodu anyị tinyegorolarị ndị ọrụ / email.py

def send_html_email(user, mail_subject, html_message):
    to_email = user.email
    username = user.username
    if to_email == '':
        return None
    unsub_link = settings.BASE_URL + user.profile.create_unsubscribe_link()
    html_message = html_message + "<p><a href=\"" + unsub_link +  "\" + title=\"Unsubscribe from " + settings.SITE_NAME + " emails\">Unsubscribe</a></p></body></html>"
    msg = EmailMultiAlternatives(mail_subject, strip_tags(html_message), settings.DEFAULT_FROM_EMAIL, [to_email], headers={'List-Unsubscribe' : '<' + unsub_link + '>'},)
    msg.attach_alternative(html_message, "text/html")
    profile = user.profile
    try:
        msg.send(fail_silently=False)
        if not profile.email_valid:
            profile.email_valid=True
            profile.save()
    except:
        profile.email_valid=False
        profile.save()

Nke a bụ ntakịrị ihe mgbagwoju anya, anyị anaghị adị njikere ịgba ọsọ koodu a. Rịba ama na anyị na-akọwapụta ihe a na-apụghị ịkọwapụta, njikọ onye ọrụ nwere ike iji wepu aha na ozi ịntanetị anyị. Nke a dị mkpa, n'ihi na ndị ọrụ ga-enwe ike ịpụ na ozi ịntanetị anyị ọ gwụla ma ha chọrọ ịhụ ha, n'oge ọ bụla. Anyị na-agbakwunye otu ederede ọzọ maka ozi anyị, nke bụ ozi HTML yigharịrị HTML. N'ikpeazụ, anyị na-enyocha ma ozi email zitere, ọ bụrụ na ọ bụghị, anyị na-egosi na profaịlụ onye ọrụ na email ha ezighi ezi.

Ka anyị laghachi na ụdị onye ọrụ ka anyị wee rụọ ọrụ a niile. Anyị kwesịrị ịkọwa ọrụ iji mepụta njikọ iji wepụta ndị aha ya, ma kọwaa ubi Boolean iji akara na email onye ọrụ adabaghị.

Nke mbu, tinye ihe ndi n'egwuregwu a kariri nke ndi oru / Models.py

nano users/models.py
# ...

Na-esote, ka anyị tinye ọrụ na onye ọrụ ahụ iji mee ka nkwonkwo ahụ wee lelee akara ngosi ahụ iji mee ka ozi ahụ rụọ ọrụ ma ọ bụrụ na ọ ga-anapụta akwụkwọ ozi ha nke ọma. Na ndị ọrụ / ụdị.py ọzọ, gbakwunye koodu na-esonụ na njedebe nke ihe nlereanya (koodu koodu)

# ...
            TimestampSigner().unsign(key, max_age=60 * 60 * 24 * 30) # Dị irè ruo ụbọchị iri atọ

Nke a dị mfe, anyị na-eji rediomementanet, nke bụ ngwa ọrụ dị egwu, iji mepụta bọket nke ga-agwụ ma ọ bụrụ na ọ dị mma. Anyị na-eji tokens ndị a ugboro abụọ, otu oge iji nyochaa email ahụ, yana ozugbo maka njikọ ahapubsos.

Ugbu a anyị nwere ndị a, ọrụ ikpeazụ nke ọrụ anyị ga-arụ bụ n'echiche. N'ime ndị ọrụ / nlele.py, ka anyị tinye nlele iji nyochaa adreesị ozi-e, yana iji wepu aha.

nano users/views.py

Nke mbu, tinye mbubata ndia. Atụgharịrị m na mgbakwunye ọzọ ka anyị ghara ibubata ihe ndị ọzọ ọzọ.

from .email import send_verification_email # Gbaa mbọ hụ na ibubata email nkwenye na-ezipụ ọrụ

May nwere ike nwee ụfọdụ n'ime mbubata a, mana ọ na-ewute ya ikwugharị ha. You 'ga-ebubata email na-ezipụ ọrụ, yana AST_Cativation_tackop_Takens, n'etiti ndị ọzọ.

Ugbu a, na ala nke faịlụ ahụ, tinye koodu a:

        # wepu aha ha
    # Ma ọ bụghị na ntụgharị gaa na ibe
# zigapu (arịrịọ, onye ọrụ)

Nke a bụ ọtụtụ koodu. Ka anyị mebie ya. Ọrụ nke mbụ, dị ọcha ma dị mfe, na-edobe onye ọrụ site na listi nzipu ozi. Ọrụ nke abụọ na-arụ ọrụ email ha, ị ga-achọpụta m gbakwunye ọrụ nkọwa, zigara. A na-anabata gị ka ị jiri Template Email na Nkọwa ọrụ izipu email nnabata, enwebeghị m. Ọrụ ikpeazụ m tụbara na dị mkpa, n'ihi na ozi email na-emebi. Ya mere, anyị ga-eweghachi ozi email n'oge ụfọdụ. Anyị nwere ike iji ụdị bụ isi maka nke a, ma kpọọ ọrụ iji zipu email nyocha. Tupu anyị emee nke a, ka anyị jide n'aka na ọ na-eziga ya na mbụ, site na ịgbakwunye ọrụ oku na nlele edebanye aha. Tinye ahịrị a dị tupu redirect na nlele ahụ, debanye aha, na ndị ọrụ / nlele.py.

nano users/views.py
# ... (mgbe) Debanye aha (arịrịọ):
# ... (tupu) redirect (

Kwesighi ịgbakwunye ahịrị mbụ na nke ikpeazụ na snippeti ahụ, jisie ike hụ na amaokwu ahụ na-eziga onye ọrụ na onye ọrụ. Ọ kwesịrị ịdị ka nke a:

# ... mbubata
            send_verification_email(user) # Gbalịsie ike ịgbakwunye ahịrị a!

Ugbu a, anyị ga-agbakwunye otu mpempe akwụkwọ iji tọgharịa email ogbugba. Na ndị ọrụ / usoro.py, tinye mpempe akwụkwọ a:

# ... (mbubata)

Anyị ga-achọkwa ndebiri kwekọrọ na mpempe akwụkwọ ndozigharị email a. Ka anyị tinye ndebiri a na. Dezie faịlụ:

nano users/templates/users/resend_activation.html

Ọzọ, tinye koodu a na faịlụ a.

Whew, nke ahụ bụ ọtụtụ! Ugbu a, mgbe anyị na-ebunye koodu na sava anyị, anyị ga-enwe ike izipu ozi email HTML ma rụọ ọrụ akaụntụ onye ọrụ na pịa na email. Anyị nwekwara ike chọọ izipu mbata mbata email dị mfe, yabụ ka anyị hụ otu esi eme ya. Laghachi na ndị ọrụ / email.py, tinye koodu a:

def sendwelcomeemail(user):
    User = get_user_model()
    html = open('{}/users/welcome_email.html'.format(settings.BASE_DIR)).read()
    subject = 'Welcome to ' + settings.SITE_NAME + ', {{ username }}!'
    template = Template(html)
    subjtemplate = Template(subject)
    context = Context({'username': user.username, 'base_url': settings.BASE_URL, 'model_name': 'Daisy Holton, 'site_name': settings.SITE_NAME})
    renderedtemplate = template.render(context)
    subjcontext = Context({'username': user.username})
    subjrenderedtemplate = subjtemplate.render(subjcontext)
    send_html_email(user, subjrenderedtemplate, renderedtemplate)

Ọzọkwa, anyị ga-achọ ndebiri iji nyeghachi ozi a niile. Na ebe nrụọrụ weebụ m, ndebiri dị ka ndị dị n'okpuru, mana ị na-anabata gị na ọ bụ gị.

Rịba ama na anyị enweghị ebumnuche mmechi ma ọ bụ HTML Tags, n'ihi na anyị na-agbakwunye ndị a mgbe anyị tinye njikọ HTML. Ndị a dị mkpa, mana anyị achọghị ịkọwa ha ugboro abụọ.

Yabụ kedu ihe ọzọ? Anyị abịala ogologo ụzọ. N'ezie, anyị kwesịrị ịdị njikere itinye saịtị ahụ na sava. Anyị nwere ike ịgbakwunye ihe ndozi @logy_requed ma mee ka echiche anyị dị nchebe, na-eziga nkwenye onye ọrụ, nke bụ ihe ndabere nke ihe ga-eme ka ọ dị mkpa. Anyị ga-agbakwunye atụmatụ ndị ọzọ bara uru, wee wuo ihe ndabere maka ibuga koodu anyị na sava anyị, ịtọlite ​​sava weebụ, nhazi na nzacha ngalaba iji mee saịtị anyị n'aka na kwesịrị ekwesị.

Anyị ga-achọ nyocha paswọọdụ, yabụ ka anyị tinye nke ahụ ozugbo. DJANGANGO wuru na nlele nrụpụta okwuntughe, mana anyị ga-eleba anya n'otú esi ede echiche nke anyị, ndebiri email, ụdị na usoro nke URL. Nke a bụ ihe nlereanya dị ka, na ndị ọrụ / nlele.py

# ... mbubata

A na-ewu ụdị a na django, mana anyị ga-achọ ndebiri iji gosipụta nrụpụta okwuntughe, ndị ọrụ / ndebiri / Paswọdu_confirts.html

Anyị nwekwara ndebiri ka izipu ozi nrụpụta paswọọdụ, yana ụdị dị mfe, na ndị ọrụ / ndebiri / ndị ọrụ / Paswọdu_Reset.html

Template maka email n'onwe ya dị mfe, ọ bụ faịlụ HTML na-arụ ọrụ iji tọgharịa okwuntughe, na ndebiri / ndị ọrụ / proses_aset_email.html. Django ga-akọwa faịlụ a na-akpaghị aka.

Anyị ga-achọkwa okpukpu abụọ ọzọ. Nke mbu bu iji gosi na ezigala email. Nlele maka ndị a adịlarị na django, yabụ anyị kwesịrị ịza ha na Urls.py. Template a dị na ndị ọrụ / ndebiri / ndị ọrụ / Paswọdu_Reset_done.html

Na nke ikpeazụ, iji gosi na nrụpụta paswọọdụ zuru oke, ndị ọrụ / ndebiri / ndị ọrụ / ndị ọrụ / paswọọdụ_Reset_complete.html

Ugbu a, anyị chọrọ usoro URL maka echiche ndị a. Na ndị ọrụ / URLS.py, tinye usoro URL ndị a:

    # ... gara aga ebe a

Ndebiri anọ, nke ahụ bụ ọtụtụ! Mana ugbu a, anyị nwere ike ijide n'aka na ị ga - enwe ike ịtọgharịa paswọọdụ onye ọrụ oge ọ bụla, niile na ihe nchọgharị weebụ.

Aghọtara m nke a bụ ọtụtụ koodu. Ọ bụrụ na ọ dị ka obere ntakịrị n'elu isi gị, nke ahụ dị mma. Will ga-akawanye mma, nghọta gị ga-akawanye mma, ị ga-enwekwu otuto karị na koodu n'oge na-adịghị anya. Ọ bụrụ na ị na-efu kpamkpam, m na-atụ aro ịlaghachi na sọftụ a ma emechaa mgbe ị na-arụ ọrụ na onwe ya na-amụta ịre ụzọ n'ịntanetị. Ndị a anaghị enwekarị ohere ịmalite, ma ga-eduzi gị ihe ọ bụla ị kwesịrị inwe ihe ịga nke ọma ma ị bịaghachila n'ọrụ a. Ọ bụrụ na ọ dị gị ka ị dịla njikere ịga n'ihu, na-ekwu, anyị ga-ekpuchi ihe nkesa na-eji Besh, yana ịtọlite ​​ọrụ gị site na iji BAYS na-eme ihe ọhụrụ na-eme ihe ọ bụla na-eme ihe ọhụrụ na-eme.

Ihe ikpeazụ anyị kwesịrị ime tupu ibuga sava dịpụrụ adịpụ na-eme ka saịtị anyị dị mma. Ga-achọpụta na elele nbanye naanị na-ewe aha njirimara na paswọọdụ, ọ nweghị ọtụtụ nyocha ma ọ bụ koodu oge. Nke a bụ ngbanwe dị mfe, yana otu koodu ahụ, anyị nwere ike ịme saịtị anyị ziga ozi ederede wee na-aza ozi ederede zigara sava. Iji bido, anyị ga-alaghachi n'ime ụdị onye ọrụ ma tinye akara ngosi oge nke ga-anọchi anya nbanye ọ bụla. Anyị ga-agbakwunye ihe nchọpụta pụrụ iche, na-atụgharị uche na ụdị onye ọrụ a ga-eji tinye nchekwa ọzọ na nbanye anyị. Edezi ụdị onye ọrụ, ndị ọrụ / ụdị.py, tinye koodu a:

# Gbaa mbọ hụ na ibubata UUID, onye na-ede akara oge na URL Generator (ntụgharị)
    # Tinye koodu a ebe a
    # Ma tinye ọrụ a
            TimestampSigner().unsign(key, max_age=60 * settings.AUTH_VALID_MINUTES) # Dị irè maka 3 mins

Gbaa mbọ hụ na ndị ọrụ gị / ụdị.py dị ka nke a, ma e wezụga nkwupụta (koodu na ahịrị na #). Ighasa nke a, ọ dị mfe. Anyị nwere ole na ole mbubata, ngwakọ nke na-atụ pryptographic nke nwere ike ibute ya iji jide n'aka na ọ dị mma, ọ bụghị naanị otu ugboro, ma ọ bụghị karịa na sekọnd. Anyị na-eji uuid, nke bụ njirimara pụrụ iche na-akọwapụta onye ọrụ anyị na ntinye aka nke akaebe, yana URL ebe ezigara onye ọrụ na-ahụ maka ihe akaebe. Anyị ga-eji nlegharị anya a bụ isi ihe abụọ. Tupu anyị emee ihe ọ bụla ọzọ, ka anyị rụọ ọrụ ndị ọzọ ka ụdị onye ọrụ anyị na-emelite. Na ndekọ ahụ na ijikwa.py, mee iwu ndị a iji mee ma mechaa ndị ị ga-aga.

source venv/bin/activate
python manage.py makemigrations && python manage.py migrate

Nke a dị mkpa n'ihi na oge ọ bụla anyị na-agbanwe agbanwe na ụdị, anyị ga-emepụta tebụl ahụ ma melite nchekwa data ahụ tupu anyị enwee ike iji ụdị ahụ.

Na-esote, ka anyị mekwaa echiche anyị iji bugharịa gaa na nlele nyocha nke abụọ. Na ndị ọrụ / nlele.py, wepụ ọrụ nbanye na redirect gaa na URL anyị ka e mepụtara na ụdị onye ọrụ.

# ... mbubata
        if user and user.profile.can_login < timezone.now(): # Mara na anyị na-enyocha ma ọ bụrụ na onye ọrụ nwere ike ịbanye
            # Wepu ọrụ Aut_login nke dị ebe a
                return redirect(user.profile.create_auth_url()) # Rịba ama anyị na-emegharị na URL ọhụrụ ebe a
            else: # Ọ bụrụ na onye ọrụ ahụ anaghị eji ọtụtụ ezigbo ihe nyocha, dị nnọọ abanye ha.
        else: # Ọ bụrụ na nbanye ahụ enweghị ihe ịga nke ọma,
            user = User.objects.filter(username=username).first() # Nke a bụ akụkụ ebe anyị na-emelite profaịlụ ndị ọrụ
                profile.can_login = timezone.now() + datetime.timedelta(seconds=15) # Ya mere ha enweghị ike ịbanye na sekọnd ole na ole

Ya mere, nke a mara mma nke ukwuu, anyị nwere ụzọ iji bugharịa ihe abụọ nyocha ahụ mgbe anyị kere ya. Anyị nwekwara ndị dara ada ma ọ bụrụ na onye ọrụ agbakwunyela nọmba ekwentị. Anyị ga-agbakwunye ihe dị mkpa iji tinye akara ekwentị n'oge na-adịghị anya wee banye na ozi ederede n'oge na-adịghị anya.

Nke mbụ, anyị chọrọ ụzọ dị mfe isi zipụ ozi ederede site na koodu anyị. Iji mee nke a, anyị nwere ike ịhọrọ n'ọtụtụ APIS, mana onye kachasị mfe n'echiche m bụ Twolio. Ha na-enyekwa ọnụahịa dị mma maka obere ọrụ, yana ụkọ ego. Mepụta akaụntụ na Twlilio.com, dejupụta nkọwa ụfọdụ gbasara ọrụ gị, zụta nọmba ekwentị, ma detuo igodo API gị na ntọala gị.py. Mgbe ahụ, tinye koodu a n'okpuru faịlụ ọhụrụ, ndị ọrụ / SMS.py.

nano users/sms.py
# Bubata ngwugwu niile dị mkpa
# Koodu a na-eziga ederede na Twolio
# Ọrụ inyeaka iji nweta nọmba na ọtụtụ ọnụọgụ
# Zipu ederede iji nyochaa onye ọrụ ahụ
# Ziga onye ọrụ ederede ọ bụla na ọrụ a
# Mechie koodu a na ọrụ a
# Egosiputa oge

Gbalịsie ike ịgbanwe ntọala gị nke ọma, na-agbakwunye ahịrị ndị a na igodo gị:

# Gbaa mbọ hụ na ịpị ndị a site na dashboard gị
AUTH_VALID_MINUTES = 3 # Ọnụ ọgụgụ nke nkeji TFA na-arụ ọrụ ozugbo

Nke mbu, anyi choro uzo maka echiche nyocha nke ihe abuo anyi. Edezi ndị ọrụ / ụdị.py, tinye koodu a.

# ... mbubata
# Formdị maka ịbanye nọmba ekwentị anyị
# Ụdị maka izi ezi

Na-esote, ka anyị mepụta echiche na ndị ọrụ / nlele.py

# ... mbubata

Anyị ga-achọkwa ndebiri maka echiche abụọ a. Ka anyị tinye ndebiri MFA.

nano users/templates/users/mfa.html

Tinye koodu HTML a na Template

Nke a bụ nkọwa zuru oke. Formdị na-eziga ma ọ bụ koodu efu, ị ga-achọpụta na nlele anyị na-eziga koodu ma ọ bụrụ na anyị na-enweta koodu efu. Mgbe ahụ anyị nwere bọtịnụ edo edo edo edo edo edo edo, na ụzọ a anyị nwere ike izipu koodu na bọtịnụ ma bọtịnụ ọ bụla. Ọzọ, anyị ga-agbakwunye mpempe akwụkwọ dị mfe iji tinye nọmba ekwentị.

nano users/templates/users/mfa_onboarding.html

Tinye HTML ndị a:

Fọm a bụ ihe dị mfe, ọ na-enyefe ụdị ekwentị ahụ na-eme ka anyị kee ma na-ahapụ onye ọrụ tinye nọmba ekwentị.

Nke a mara mma n'ezie! Ọ bụrụhaala na a ga-enwe ike izipu ozi nke ọma, anyị ga-enwe ike izipu ozi, ma tinye onye ọrụ na nọmba ekwentị ha ozugbo anyị tinye usoro URL. Ihe ikpeazụ anyị kwesịrị ịtọlite ​​bụ profaịlụ nlele ka anyị nwere ike ịgbanwe nọmba ekwentị ha n'akwụsịghị, yabụ onye ọrụ nwere ike ịbanye. "Kwụsị" iji pụọ na ozi ederede ọdịnihu.

Ka anyị tinye echiche profaịlụ na ndị ọrụ / Views.py. Echiche a ga - emelite Bio onye ọrụ, email, aha njirimara, na nọmba ekwentị, yana ka anyị mee ka anyị nwee nkwenye ọtụtụ ihe. Nke mbu, anyi kwesiri ndi ozo di iche iche na ndi oru / uzo ihe.py

# ... mbubata

Ọzọ, anyị nwere ike ịmepụta otu iji ụdị abụọ a. Dezie ndị ọrụ / nlele.py ma tinye ya na echiche.

# Tinye mbubata ndị a

Anyị ga-achọkwa ndebiri maka echiche a.

nano users/templates/users/profile.html

Ga-achọpụta nke a bụ ụdị dị mfe, mana nwere ụfọdụ javascript na ya nke na-akpaghị aka na-eziga ọdịnaya nke ụdị dị ka a na-emelite. Nke a bara uru inwe, yabụ ị ga - enwe ike ịmezizits na - enweghị ka ịgafe nyefee oge ọ bụla.

Ọzọ, anyị chọrọ URLS na-anọchite anya echiche ndị a niile na ndị ọrụ URL. Dezie ndị ọrụ / URLS.py ma tinye koodu a:

# ... koodu gara aga, ibubata
# ... usoro URL anyị abanyela na mbụ, gbakwunye ahịrị atọ na-esote

Ugbu a bụ oge dị mma iji nwalee ọrụ anyị. Mana buru ụzọ, ka anyị banye nkwado ọzọ.

backup

Ma gbaa ihe nkesa. Tupu anyị mụbaa na sava Linux, ọ bụ ezigbo echiche iji mee ka nyocha abụọ na akaụntụ ahụ. Anyị ga-eme nke a na URL profaịlụ anyị, profaịlụ / profaịlụ /, na ịlele igbe iji mee ka ọ bụrụ na itinye nọmba ekwentị anyị, wee na-enyefe mpempe ekwentị anyị.

python manage.py runserver localhost:8000

Gaa na websaịtị gị site na ịga na ihe nchọgharị weebụ gị, m na-eji Google Chrome na ihe atụ a, ma banye URL HTTPS: // Homeshost: 8000 / akaụntụ / Profaịlụ /

Will ga - enwe ike ịbanye ma ọ bụrụ na ọ dị mkpa ma nwee nkwenye abụọ.

Ngalaba a chọrọ sava iji gbaa ọsọ na ya, ọ nwere ike izipu ozi. Mana buru ụzọ, anyị chọrọ ụzọ isi lee njehie. Ga-achọpụta na ọ bụrụ na ị na-agba ihe nkesa na ọnọdụ mpaghara, yana ntọala .debug nhata, ihe nkesa na-egosi njehie na-akpaghị aka. Iji gosi njehie n'emeghị ka ọnọdụ debug, nke na-adịghị mma na sava nkesa, anyị kwesịrị ịgbakwunye nlele maka ya. Ihe ndị kachasị mkpa anyị kwesịrị inwe ike iji aka bụ:

Njehie 500 - nsogbu na koodu anyị Njehie 404 - peeji nke ahụghị (URL mebiri) Njehie 403 - ikike ekweghị ekwe

Ka anyị tinye ngwa ọhụrụ iji dozie njehie ndị a, akpọrọ njehie.

python manage.py startapp errors

Tinye nke a na ntọala.py ka anyị mere tupu, na ntinye aha ya, wee bido site na ịgbakwunye ntụnye aka na ngwa / URLS.py.py, ebe ngwa bụ aha ọrụ Django gị.

handler404 = 'errors.views.handler404'
handler500 = 'errors.views.handler500'
handler403 = 'errors.views.handler403'

Nke a bụ naanị ihe anyị chọrọ na - ewepụta njehie, ndebiri na ntakịrị nke etiti. Ka anyị kọwaa ndị dị ka:

# Mepụta echiche gị ebe a.

Na-esote, ka anyị kọwaa etiti igwefoto iji kwado njehie ndị a. Anyị ga-eme nke a site na mbụ na-agbakwunye ihe ndị etiti_clus_classes na ntọala.py, na aha nke etiti anyị.

    # ... gara aga etiti

Na-esote, ka anyị tinye etiti.

from threading import local
import traceback
from django.utils.deprecation import MiddlewareMixin

_error = local()

class ExceptionVerboseMiddleware(MiddlewareMixin):
    def process_exception(self, request, exception):
        _error.value = traceback.format_exc()

def get_current_exception():
    try:
        return _error.value
    except AttributeError:
        return None

def set_current_exception(exception):
    try:
        _error.value = exception
    except AttributeError:
        print('Attribute error setting exception.')

Anyị na-agbakwunye ọrụ iji nweta ugbu a site na iji mpaghara na-eri, nke na-enyere anyị aka ịmata njehie ọ bụla na koodu anyị. N'ihe banyere ndebiri, anyị ga-achọ naanị otu, n'ihi na anyị na-akọwa isiokwu ahụ n'echiche. Ihe ndebiri ahụ kwesịrị inye aha aha ya na "Chọpụta", ọnọdụ anyị Hiaceback site na gburugburu.

nano errors/templates/errors/error.html

Nke a bụ ndebiri kachasị dị mfe ma, mana nke ahụ bụ mfe ọ bụ ịhụ njehie ndị a n'ọrụ anyị. Na-esote, ka anyị gbanyụọ Big na ntọala.

nano app/settings.py

Chọta ahịrị a ebe edobere eziokwu, ma gbanwee ya na ụgha

DEBUG = False

Gaa n'ihu na ndabere ugbu a. Anyị dịla njikere ịbanye na sava Linux dịpụrụ adịpụ, ma na-agbakwunye atụmatụ na ebe ahụ.

sudo backup

Tupu anyị ebubata koodu a na sava, anyị kwesịrị ịtụle na enwere ike inwe ụfọdụ nsogbu na koodu ahụ. Dabere na ikpe ahụ, saịtị na-anabata ozi edepụtara na ha ga-enwe nsogbu na spam na-eziga na ike wepụ spam ahụ. Nke a ekwesịghị ime ozugbo, mana ọ bụrụ na ọ na-eme, anyị ga-emecha nyochaa ihe ndekọ ahụ na-akpaghị aka, ma nyochaa njirimara onye ọrụ ma ọ bụ ihe nyocha nke biometric, dị ka akara mkpịsị aka.

Na-ele anya na ọtụtụ ihe atụ nyocha nke ọtụtụ nyocha, na mmepụta, ihe nwere ike ịdị iche. Rịba ama etu anyị si adị ọnụ ahịa na-eme ka njigide, na ịka nká. Ọ bụrụ na robots na-enweta saịtị, nyocha ihe abụọ nwere ike isi ike karịa ka ha nwere ike itinye koodu n'otu oge onye ọrụ ahụ. Iji luso nke a ọgụ, ka anyị jiri ihe nlereanya na ụdị onye ọrụ, na-ekwupụta otú anyị si emekọrịta ihe mgbe anyị na-eji nọmba ekwentị na nọmba ekwentị. Anyị ga-agbakwunye otu nhọrọ iji nyochaa na email. Bido site na edezie ụdị onye ọrụ na Nano.

nano users/models.py

Nke a bụ ihe ụdị anyị na-agbakwunye kwesịrị ịdị ka. Anyị achọghị ụzọ ọ bụla, dịgasị iche iche iji chekwaa NJ, onye ọrụ, oge mbu, ogologo ma na-anwale ekwentị ma ọ bụ email).

# Ihe eji eme ihe eji abanye na weebụsaịtị

Ka anyị tinye onye ọrụ anyị ihe ùgwù, anyị ga-etinye ya aka ike ugbu a, n'ihu n'ikpeazụ kwaga ijeri ndị ọrụ ihe ùgwù na akpaghị aka. N'ime ụdị onye ọrụ, tinye ahịrị a na profaịlụ:

    vendor = models.BooleanField(default=False)

Dịka ọ dị na mgbanwe ọ bụla na nchekwa data, anyị kwesịrị ịme ndị na-akwaga ma kwaga na nchekwa data oge ọ bụla dezie faịlụ dị iche iche.py na DJango. Cheta, ime nke a, anyị na-eji isi mmalite (ọ bụrụ na ejiribeghị ya kemgbe ahụ, ebe ọ bụ na Python jikwaa.py iji mee ka ndị njem na ịkwaga ya.

cd project-directory-you-named # (ọ bụrụ na achọrọ)

Ka ọ dị ugbu a, ị nwere ike itinye akaụntụ ọ bụla ị mepụtara dịka ndị na-ere ahịa site na iji shei ahụ.

python manage.py shell
from users.models import Profile
p = Profile.objects.get(user__username='Charlotte')
p.vendor = True
p.save()
exit()

Ugbu a, ka anyị mepụta echiche ebumnuche anyị ọtụtụ ihe iji jiri akara a. Nke mbu, anyi kwesiri igbanwe oru nd i inyeaka m. Iji Nano,

nano users/mfa.py
from django.utils import timezone
import random
import datetime
from django.conf import settings
from feed.middleware import get_current_request
from django.contrib import messages
from .email import send_html_email
import traceback
from .models import MFAToken

account_sid = settings.TWILIO_ACCOUNT_SID
auth_token = settings.TWILIO_AUTH_TOKEN
source_phone = settings.PHONE_NUMBER

def send_text(target_phone, text):
    from twilio.rest import Client
    try:
        client = Client(account_sid, auth_token)
        if len(target_phone) >= 11:
            message = client.messages.create(
                to=target_phone,
                from_=source_phone,
                body=text + ' Text STOP to cancel.')
    except:
        messages.warning(get_current_request(), 'There was an error sending the message.')
        print(traceback.format_exc())

def get_num_length(num, length):
    n = ''
    for x in range(length):
        n = n + str(num)
    return int(n)

def send_verification_text(user, token):
    length = user.profile.verification_code_length
    code = random.randint(get_num_length(1, length), get_num_length(9, length));
    token.token = code
    token.expires = timezone.now() + datetime.timedelta(minutes=settings.AUTH_VALID_MINUTES)
    token.save()
    send_user_text(user, "Your verification code for {} is {}".format(settings.SITE_NAME, str(code)))

def send_verification_email(user, token):
    length = user.profile.verification_code_length
    code = random.randint(get_num_length(1, length), get_num_length(9, length));
    token.token = code
    token.expires = timezone.now() + datetime.timedelta(minutes=settings.AUTH_VALID_MINUTES)
    token.save()
    send_html_email(user, "Your verification code for {} is {}".format(settings.SITE_NAME, str(code)), "<p>Dear {},</p><p>Your verification code for {} is {}. Thank you for using this code to secure your account.</p><h2>{}</h2><p>Sincerely, {}</p>".format(user.profile.name, settings.SITE_NAME, str(code), str(code), settings.SITE_NAME))

def send_user_text(user, text):
    send_text(user.profile.phone_number, text)

def check_verification_code(user, token, code):
    token.attempts = token.attempts + 1
    profile = user.profile
    result = (token != None and code != '' and token.token == code and (token.expires > timezone.now()) and token.attempts <= settings.MFA_TOKEN_ATTEMPTS)
    if token.attempts < 3 and result:
        profile.verification_code_length = 6
    elif token.attempts > 1 and not result:
        profile.verification_code_length = profile.verification_code_length + 2
        if profile.verification_code_length > settings.MFA_TOKEN_LENGTH: profile.verification_code_length = settings.MFA_TOKEN_LENGTH
    token.save()
    profile.save()
    return result
# Nyochaa onye ọrụ site na iji email ma ọ bụ nọmba ekwentị ha
    token = MFAToken.objects.filter(uid=username, expires__gt=timezone.now() + datetime.timedelta(seconds=30)).order_by('-timestamp').last() # Jiri akara aka na URL gafere na URL (UUID)
    if not token: token = MFAToken.objects.create(user=User.objects.filter(profile__uuid=username).first(), uid=username, expires=timezone.now() + datetime.timedelta(seconds=115)) # Ọ bụrụ na emebeghị nnọkọ a, mepụta ya
    user = User.objects.filter(id=token.user.id).first() # Nweta onye ọrụ site na Token
    if not user and request.user.is_authenticated: return redirect(reverse('feed:home')) # Ọ bụrụ na ha enyochala, na-edebanye aha ha
    if not user: raise PermissionDenied() # Gọnarị ma ọ bụrụ na achọtara onye ọrụ
    if not user.profile.enable_two_factor_authentication and user.is_active and user.profile.check_auth_token(usertoken, token): # Lelee akara ahụ
        auth_login(request, user, backend='django.contrib.auth.backends.ModelBackend') # Banye onye ọrụ ma ọ bụrụ na ha abanyebeghị
        user.profile.mfa_expires = timezone.now() + datetime.timedelta(minutes=settings.LOGIN_VALID_MINUTES) # Nịm Nbibi na Nchọpụta Ihe Multi
        return HttpResponseRedirect(next if next != '' else reverse('landing:landing')) # Redirect onye ọrụ na peeji na-esonụ
    if not user.profile.mfa_enabled: # Lelee ma ọ bụrụ na enyere MFA
        if not check_verification_time(user, token): # Lelee oge
            user.profile.mfa_enabled = False # Kpochapụ nọmba ekwentị
            user.profile.enable_two_factor_authentication = True # Kwado MFA
            user.profile.phone_number = '+1' # Gbanyụọ nọmba ekwentị
            user.profile.save() # Chekwaa profaịlụ
            auth_login(request, user, backend='django.contrib.auth.backends.ModelBackend') # Banye onye ọrụ ma ọ bụrụ na enyereghị ha MFA ha
    if request.method == 'POST' and not fraud_detect(request, True): # Ọ bụrụ na arịrịọ ahụ bụ arịrịọ post
        form = TfaForm(request.POST) # Ozugbo ahụ mpempe akwụkwọ ahụ
        code = str(form.data.get('code', None)) # Nweta koodu
        if code and code != '' and code != None: # Gbaa mbọ hụ na ọ bụghị ihe efu
            token_validated = user.profile.check_auth_token(usertoken) # Lelee akara ahụ
            is_verified = check_verification_code(user, token, code) # Lelee koodu
            if token_validated: # Ọ bụrụ na ihe niile
                if is_verified: # Dị n'usoro
                    user.profile.mfa_enabled = True # Kwado MFA (ọ bụrụ na emebeghị)
                    auth_login(request, user, backend='django.contrib.auth.backends.ModelBackend') # Banye onye ọrụ
                    for key, value in request.GET.items(): # Mee ka ihe nyocha maka parameter ọzọ (ma ọ bụrụ na ọ bụla)
                        return HttpResponseRedirect(next) # Redirect
            elif not token_validated: # Ọ bụrụ na onye na-eme ihe ezighi ezi
            if p.mfa_attempts > 3: # Ọ bụrụ na enwere ọtụtụ mgbalị
            if form.data.get('send_email', False): # Zipu email (ma obu ederede)
    # Ntinye akwụkwọ (maka inweta arịrịọ)

Mgbe anyị na-agbakwunye na koodu a, gbaa mbọ ka ibubata ọrụ iji zipu email. N'elu faịlụ ahụ, echiche onye ọrụ (ya na ndị ọzọ bubata), tinye

from .mfa import send_verification_email as send_mfa_verification_email

Ugbu a, anyị kwesịrị ide ọrụ ahụ tupu nke a ga-arụ ọrụ. Ọ kwesịrị ịgbatị ọrụ email anyị, ma ziga email na onye ọrụ na koodu nkwenye.

nano users/mfa.py
def send_verification_email(user, token):
    length = user.profile.verification_code_length
    code = random.randint(get_num_length(1, length), get_num_length(9, length));
    token.token = code
    token.expires = timezone.now() + datetime.timedelta(minutes=settings.AUTH_VALID_MINUTES)
    token.save()
    send_html_email(user, "Your verification code for {} is {}".format(settings.SITE_NAME, str(code)), "<p>Dear {},</p><p>Your verification code for {} is {}. Thank you for using this code to secure your account.</p><h2>{}</h2><p>Sincerely, {}</p>".format(user.profile.name, settings.SITE_NAME, str(code), str(code), settings.SITE_NAME))

Ya mere, ihe a niile na-arụ ọrụ dị ukwuu, ugbu a anyị nwere ọtụtụ usoro nyocha ekwentị ma ọ bụ email iji wepu, ma ọ bụ na ọ dịkarịa ala zoo ndị ọrụ na-anaghị etinye aka na usoro anyị. Ndị a nwere ike ịbụ spammers, robots ma ọ bụ onye ọ bụla nke na-apụtaghị nke ọma maka ọrụ anyị. Lelee nlele m nwere maka nlekota oru na ebe nrụọrụ weebụ m:

# mbubata
from .tests import is_superuser_or_vendor # Anyị kwesịrị ịmepụta ule a
    # Nweta ndepụta nke ndị ọrụ
    return render(request, 'users/users.html', { # Weghachi ndị ọrụ na ndebiri

Rịba ama na koodu a na-eji nnwale, anyị ga-akpọsaara ule a na nnwale. Edezi ndị ọrụ / nnwale.py, ka anyị mepụta ule ahụ.

def is_superuser_or_vendor(user):
    return user.profile.vendor or user.is_superuser

Nke a bụ na njikọta na ndị ọrụ / ndị ọrụ.html, nke na-ele anya dị ka:

Rịba ama na ndebiri gụnyere ndebiri ọzọ, ndị ọrụ /Onye ọrụ .html. Mgbe ị na-eji ndebiri nke nwere ndepụta okwu ọ bụla, ọ naghị eji ịgbatị, ezigbo echiche ịgbakwunye nri () tupu aha faịlụ agbatị, iji mata ihe ndebiri.

Rịba ama na nke a bụ ọtụtụ nke Jinja, ịnwere ike ọ gaghị enwe ike ị nweta ndị a na-agbanwe agbanwe. Mana nke a bụ ihe koodu m dị ka.

      <small># {{onye ọrụ.ID} </ obere>

Anyị chọkwara ndepụta ọzọ, togle_astris.html. Template a kwesịrị ịbụ otu ụdị na-enye anyị ohere ịmalite ma onye ọrụ na-arụ ọrụ.

Anyị ga-atụkwasịkwa otu echiche iji mee ọrụ onye ọrụ, na usoro URL kwesịrị ekwesị. Ọ bụ ezie na anyị nọ na ya, ka anyị tinye echiche iji hichapụ onye ọrụ ma ọ bụrụ na anyị chọrọ nke ahụ.

# Mbubata
    success_url = '/' # Redirect na URL ga-aga nke ọma
    def test_func(self): # Nwalee ma ọ bụrụ na onye ọrụ bụ onye njikwa ma nwee ikike ihichapụ

Ọ bụ ezie na nke a bara uru mgbe ọ dị mkpa, ihichapụ onye ọrụ ekwesịghị ịdị mkpa kachasị mkpa n'oge ahụ, anyị nwere ike ịgbanye anya ọhụma nke ndị ọrụ na-eleta saịtị ahụ ma ọ bụrụ na anyị mkpa ịchụpụ ha.

The URL anyị gbakwụnyere na ọ dị ka nke a. Na Nano, Dezie Ndị Ọrụ / URLS.py ma tinye ahịrị ndị a:

nano users/urls.py

Lines ga-aga na ndepụta nke ụzọ na echiche onye ọrụ, tupu ngwụcha "] ma mgbe mmalite" [".

# ...
# ...

Ugbu a, gbaa mbọ hụ na ịkwado saịtị ahụ ka ị nwee ike ibudata ya na sava weebụ anyị ga-anọgide na-arụ ọrụ na. Site na akara iwu,

sudo backup

Ugbu a, saịtị anyị akwadowo.

Yabụ ugbu a, anyị nwere ọtụtụ atụmatụ ọzọ bara uru. Ma gịnị banyere ihe onyonyo a ebe a? Koodu a enweghi ike inweta site na Internetntanetị, anyị enweghị ihe nkesa ozi ma, anyị kwesịrị ịgbasa usoro nkwenye anyị yana iji nyere anyị aka inyocha saịtị ahụ, yana usoro nchekwa echekwara maka izi ezi ndị ọrụ.

Anyị ga-erute ihe a niile. Ihe kachasị mkpa maka ugbu a ga - enwe ike ịnweta koodu a n'ịntanetị, nke anyị nwere ike iji naanị ahịrị na - eme ihe nkesa UBUNU. Willkwesịrị ịgbazite ihe nkesa na nke a, belụsọ na ịnwere sava n'ụlọ na ndenye aha ịntanetị na-enye gị ohere ịmepe ọdụ ụgbọ mmiri. Akwụsịrị m ebe nrụọrụ weebụ m na HP Z440 arụnyere na ụlọ m, mana ọ na-adị ọnụ ala karịa maka mkpa ọ dị iji gbazite sava onwe (VPS).

Buru n'uche na koodu anyị na-agba ugbu a dị oke mkpa, ọ ga-adị mkpa ka a nọgidesie ike ma meziwanye tupu anyị ejila ngwaahịa. Gbalịsie ike iji nlezianya kpachara anya ihe ị na-eme na Internetntanetị, jide n'aka na ị ga-ebugharị saịtị a n'ihu ebe nrụọrụ weebụ, ị nwere atụmatụ igbochi mmekọrịta na-achọghị mmekọrịta na weebụsaịtị gị. Eleghị anya nke a agaghị abụ nsogbu na mbụ, mana anyị ga-eleba anya n'ụdị ọtụtụ nyochara ọgụ, gụnyere mmụta igwe, ọgụgụ isi na ọhụụ. Mgbe ọ ghọrọ nsogbu, lee anya na ederede a maka ihe ngwọta.

N'usoro ịgbazite VPS, enwere ọtụtụ ebe ị nwere ike ịga. Cloud Cloud nwere sava VPS, Ionos, Kamane, Kamane, ndị ọzọ na-enye ihe nkesa igwe ojii ga-eji mkpa anyị.

Ga-ejikwa mpempe akwụkwọ ha pịa ma họrọ atụmatụ iji bido. Can nwere ike iji atụmatụ ọ bụla na-eweta, mana jide n'aka na onye na-eweta ya na-enye gị ohere ịmepe Port Server Port izipu (nke a kwesịrị Port 587 na ọdụ ụgbọ mmiri 25), ụfọdụ ndị na-eweta na-egbochi ọdụ ụgbọ mmiri ndị a. Ruo ugbu a enwere m ahụmịhe kachasị mma na Ionos na Kamama, ha abụọ ga-enyere m aka izipu ozi email na-akparaghị ókè na ọnụahịa ha dị oke ọnụ ala.

Will ga - ejikọ ihe nkesa ọhụrụ gị na otu usoro a na - akpọ SSH ma ọ bụ nchekwa nchekwa, nke na - enye gị ohere ịtụgharị na ihe nkesa ahụ dị ka kọmputa gị, site na kọmputa gị. Mgbe ị guzobere sava ahụ, ọ nwere ike ịrịọ gị ka ị tinye igodo SSS, ma ọ bụ nye gị aha njirimara na paswọọdụ. Igodo ssh bụ otu ị ga - esi banye na sava ahụ site na akara iwu iji dezie koodu ahụ. Jiri nhọrọ SSH-Keygen dị n'okpuru iji mepụta igodo SSS.

ssh-keygen

Chekwaa faịlị ahụ ma degharịa ya ma ọ bụrụ na ịchọrọ, ọ dị mma ịmegharị igodo SSH gị ma ọ bụrụ na ị nwetabeghị. Ugbu a, ịnwere ike iji iwu a iji hụ igodo SSS gị. Will ga - achọ idetu ya na sava gị dịpụrụ adị, ị ga - eji ya nyochaa ya.

cat ~/.ssh/id_rsa.pub

Ọ bụrụ na ịnweghị ike ịhụ igodo SSS mgbe ọnụọgụgụ na mkpụrụedemede na-amalite na "SSH-RA AAA)

ssh-keygen -t rsa -b 4096

Mepụta VPS na-agba Obuntu, n'agbanyeghị na ị na-eme atụmatụ ime nke a. Ozugbo imepụtara VPS site na ịpị ụdị na weebụsaịtị ndị na-eweta (Kamas.com ma ọ bụ adreesị IP gị (adreesị SSHIGY gị (adreesị SSH.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX). Ga-enwe mmetụta dị nro na aha njirimara ndabara na sava ahụ anyị mepụtara, dịka ọmụmaatụ, ubuntu.

ssh ubuntu@XX.XX.XX.XX

Enwere ike ịjụ maka paswọọdụ, ma ọ bụrụ na ajụrụ gị maka paswọọdụ, tinye ya na. Anyị agaghị eji njirimara ọhụụ na ịgbakwunye akara SSS na akaụntụ ha.

Ka anyị bido site na ịgbakwunye faịlụ sshd_config ọhụrụ, nke na-agwa ihe nkesa otu esi eji SSH.

nano sshd_config
# Nke a bụ faịlụ nhazi SSHD siri ike.  Ile
# sshd_config (5) maka ozi ndị ọzọ.
# A na-eji SSHD a na ụzọ = / USR / Mpaghara: / USR / SBIN / BI: / SB: / USR / Egwuregwu
# Usoro a na-eji maka nhọrọ na ndabara sshd_config butere ya
# Oghesh bụ ịkọwapụta nhọrọ na akụrụngwa ha
# enwere ike, ma hapụ ha kwuru.  Nhọrọ na-enweghị ọgwụ
# ndabara uru.
# Ọdụ ụgbọ mmiri 22
# Na-agwa okwu ọ bụla
# Gere ntị 0.0.0
# Gee ntị ::
# Berredy / wdg / Ssh_host_rsa_key
# Berredy / wdg / Ssh_host_ecdssa_key
# Berredy / wdg / Ssh_host_ed2519_key
# Ciphers na igodo
# Rekeylimit ndabara ọ bụla
# Nkoo onwe
# Sylogfacy
# Ihe omuma banyere ihe omuma
# Nyocha:
# Nbanye 2M
# Ikike ikike-paswọọdụ
# Plemples ee
# Maxethtries 6
# Maxssass 10
# Na-atụ anya ka a na-atụ anya.
# Ndị isi ikike
# Ikike enyere ikike
# Ikikere ikike na-enweghị onye ọ bụla
# Maka nke a ịrụ ọrụ ị ga - achọkwa igodo nnabata na / wdg / SSH / SSH_ST
# Onye Alostbaseddathatication Ọ dịghị
# Gbanwee gaa ee ee ma ọ bụrụ na ị tụkwasịghị ~ / .ssh / a ma ama_host maka
# BostBarBasedauthentication
# Na-eleghara anya
# Agụla onye ọrụ ~ / .rhosts na ~ / .Hosts faịlụ
# Na-eleghara anya ee
# Iji gbanyụọ okwuntughe ederede doro anya, gbanwee na no ebe a!
# Kwe kampyPypypywords no
# Gbanwee gaa ee ee iji mee ka okwuntughe nke ihe ngosi (kpachara anya
# ụfọdụ pam modulu na eri)
# Nhọrọ Kerberos
# Kerbersathaticatication mba
# Kerbersorlocalpdwh ee
# Kerbersticketcleap Ee
# KerberSigesafstafstaf
# Nhọrọ GSSAPI
# Gssapiauthotication mba
# Gssapicleaupceresia
# Gssapistriaccept ee
# Gssapikeyexchange mba
# Debe nke a 'ee' iji mee ka nyocha patter, nhazi akaụntụ,
# na nhazi nnọkọ. Ọ bụrụ na enyere nke a, nyocha Pam ga-eme
# ka ekwe ka KBDeberatic na
# Nkwusa echiche.  Dabere na nhazi pam,
# Nchọpụta Pam Via Kbdbectativenticatienticatie nwere ike ịgabiga
# Ọnọdụ nke "Ikike ikike na-enweghị paswọọdụ".
# Ọ bụrụ na ịchọrọ akaụntụ Pam na ndenye ego na-agba ọsọ na-enweghị
# Nchọta Pam, wee mee ka nke a mee ihe ma tọọ paswọọdụ
# na kbdbectiveativenticatienticatienticatienticatienticatienticatienticatienticatienticatienticaticationa na 'mba'.
# Hazie Iha
# Hapụ ee
# Isi na-enweghị
# X11DIsplayffsed 10
# X11USOCOTHOS Ee
# Permitty Ee
# Biputere EE
# Tcpkeepealive ee
# Onyinye ikike
# Mgbakwunye Oge
# Ndị ahịa na-ere ahịa 0
# KọfịvivecountMax 3
# Ejiri ọ bụla
# Pidfile /run/sshd.pid
# Maxstartups 10: 30: 100
# Permithunnes na
# Chootdirectory onweghi
# Addaddendum
# onweghi uzo ọkọlọtọ
# Kwee ka onye ahịa gafee mgbanwe dị iche iche gburugburu ebe obibi
# Kpagbuo ndabara nke enweghị ndị na-akwụ ụgwọ
# Ihe atụ nke ngbanwe na-aga n'ihu na ngalaba ọrụ
# Dakọtara onye ọrụ Annoncvs
# X11Fagel mba
# Hapụ ma ọlị
# Permitty no
# ForceCumland CVS Server

Cheta, Ctrl + X na Y iji chekwaa faịlị. Na-esote, ka anyị dee ederede dị mkpa a na-akpọ Bido (Niile ndekọ ụlọ nke onye ọrụ anyị).

nano initialize

Tinye ahịrị ndị a na faịlụ ahụ, dochieSite na igodo SSS gị achọtara iji cat. (.ssh / id_rsa.Pub)

# ! / Bin / Bash

Iji jee ije na faịlụ a, ka anyị bido ahịrị site na ahịrị. Ahịrị nke mbụ na-agwa onye na-ejikọ ihe a bụ akara ngosi. Mgbe ahụ anyị na-etinye ndị mmadụ na-arụ ọrụ, na-emegharị SSHD_Config gaa na ndekọ ziri ezi, na-ebugharị na SSH, ịnwere ike ịhọrọ aha gị na aha ha na paswọọdụ nwere nkwarụ maka ugbu a). Anyị na-agbakwunye otu na ndị otu sudo, mepụta ha igodo SSH, tinye igodo anyị na igodo ikike na nke ha, ma bipụta igodo ha. Onye ọrụ ọhụụ a ga - abụ otu anyị si abanye na saịtị ahụ.

N'ime ọdụ ụgbọ mmiri ọhụrụ, gaa n'ihu mepee ihe nkesa ahụ ọzọ.

ssh team@XX.XX.XX.XX

Kwesighi ịchọ paswọọdụ oge a, ịdị ka ị nwere igodo SSH. Anyị enwekwala paswọọdụ nwere nbanye na paswọọdụ iji mee ka nchekwa ahụ karịa.

Ugbu a, ihe nkesa a na-amalite oghere kpamkpam na-enweghị ozi na ya. Ka anyị bido site na ịmịnye ọrụ anyị site na Git otu anyị nwere ike ibudata ma jiri igwe dịpụrụ adịpụ. Na sava dịpụrụ adịpụ ejikọtara na SSH, buru ụzọ bipụta igodo SSS gị:

cat ~/.ssh/id_rsa.pub

Na-esote, mado igodo a n'ime Ntọala Git dị ka anyị mere tupu anyị guzobe ebe nchekwa GIT anyị. Anyị nwere ike ịmepụta ọrụ anyị ozugbo na sava ahụ. Gbaa mbọ hụ na ị kwadola ọrụ ahụ mpaghara mbụ yabụ na ọ dị na sava Git iji budata.

git clone git://github.com/you/yourproject.git

Zuru oke. Ugbu a faịlụ niile dị ebe a. Anyị nwere ike ịhụ ha na ls

ls

Ugbu a, ka anyị bido ịtọ sava ahụ. Nke mbu, detuo ndekọ oru gi n'ime aha echefu echefu, anyi ga eji oru a.

cp -r yourproject whatyoucalledit

Ebe "ihe kacha ere" bụ aha ọhụrụ nke ọrụ gị. Ọzọ, anyị kwesịrị iwulite ọrụ dị mkpa iji dozie sava ahụ. Anyị ga-echekwa uru a ma jiri ya n'ọdịnihu. Iji wulite ike a, ka anyị mepụta ọnụọgụ ọnụọgụ abụọ iji kọwaa otu anyị si dezie edemede. Iji Bash, Dezie / USR / Bin / Ascript

sudo nano /usr/bin/ascript

Gbalịsie ike iji sudo ebe ahụ ka ịnwere ikikere iji dezie faịlụ ahụ. Na faịlụ, tinye ahịrị ndị a:

# ! / Bin / Bash
    echo "# ! / / Bin / Besh ">> / USR / Bin / $ 1

Cheta edemede a nwere esemokwu, aha edemede, dị ka $ 1. Nke mbu ọ na - enyocha ma ọ bụrụ na faịlụ ahụ na --ewe ya, na - emepụta ya, na - agbakwunye akara ya, ma tinye ya na akwụkwọ edemede anyị na - eme. Ọ bụrụ na faịlụ ahụ adịlarị, naanị gbanwee ikike ma dezie ya. Chekwaa faịlị, nke ọzọ, anyị ga-agbanwe ya bụ ikikere. Ọ bụrụhaala na anyị jiri edemede a, anyị agaghị eme nke ahụ ọzọ.

sudo chmod a+x /usr/bin/ascript

Zuru oke. Ugbu a, ka anyị mepụta edemede akpọrọ Mbido. Nke mbu, obughi karie gi, ma lee anya ihe ederede ederede m di. Anyị ga-eje ije n'ihe edemede a kwesịrị ịdị na ọrụ gị, ị gaghị achọ ihe niile na edemede m ịmalite.

# ! / Bin / Bash
# Sudo chmod A + X Scripts / Ọrụ
# ./script/ustersup
# ssh-Keygen
# Nkwado nka
# Iwu ndekọ
# Nano Config
# Git config
# Melite ma wụnye
# Kwado Clamav Antivirus
# Tọọ aha nnabata
# Mbido postgres
# Mbido nchekwa data
# Gbanyụọ ite
# Wụnye BitDeefnender
# Mbido postfix
# Mepụta Ihe Nzi
# Setịpụ VirtualNV
# Nweta ma wuo ha
# Tọọ iwu Firewall
# Wụnye PuyI
pip3 install --upgrade opencv-python # == 4.5.4.60
pip3 install --upgrade opencv-contrib-python # == 4.5.4.60
# Pip wụnye Opencv-Python == 4.5.5.64
# Pip wụnye Opencv - Python == 4.5.5.64
# Wụnye Witsbot
# Na-agba ọsọ
# Rebura Mail Server
# Detuo cers
# Sudo CP /etc/letscrypt/live/femmebabe.com/privkey.pem
# Sudo Cp /etc/letscrypt/live/femmebabe.com/cert.pem cert.pem
# Patch venv
# Debe ntọala onye ọrụ
# Debe ikikere
# Otu Sudo Chado -r: Ndị ọrụ / Var / Run /
# Mgbakwunye Soudo Borown: Mgbakwunye / Run / Sudo / ts-ts-ts-ts-ts-ts-ts-ts-ts-ts-ts-ts-ts-ts-ts-ts
# sudo chmod 664 db.sqlite3
# Sudo Coot-Rewa-Data: Ndị ọrụ DB.SQLITE3
# Detuo nhazi ma nye ikike
# Mbido nchekwa data
# Na-egbochi pam ma wepu SSH Config
# Sudo Sed -i '' $ d '/etc/pam.d/sshd
# Sudo Sed -i '' $ D '/ wdg / profaịlụ
# Detuo Beberus na Ikikere
# Ibugharị na Kwaga Ọrụ
# Kwado Apache
# Sudo A2Dissod mpl_event
# Sudo A2Dissod MPM_Worner
# Sudo A8Nmod MPM_PREFKK
# Gbanyụọ saịtị saịtị
# Kwado saịtị anyị
# Bugharịa daemon ma malitegharịa Apache, PostFix na Opendkim
# Debe ikikere
# Nhazi Swap
# Injin Injin
# Stup git
# Gosi IPV6 na Opendkim Maka Nhazi
# Mbido dechara

Nke ahụ bụ ọtụtụ ntọlite! Na nkenke, koodu koodu a na-edebanye aha, na-ahazi nano na Git, na-ahazi ihe nchekwa data, na-eme ka ihe nchekwa data) Asambodo ma melite sava ahụ, wụnye nhazi, na-amalite ma na-enyere ndị na-enweghị nzọ, setịpụ ikike, ma na-ebipụta IP, adres IPV6 na igodo OPEDKIM. Dị mfe, mana ọ dị ka koodu buru ibu. Anyị agaghị achọ ọtụtụ nke a n'ihi na anyị enweghị ihe ndị ahụ, anyị anaghị eji Celery, anyị anaghị eji celery ma ọ bụ Daphne, mana anyị ga-etinye ụfọdụ n'ime ha, mana anyị ga-etinye ụfọdụ n'ime ha. Rịba ama na koodu a nwere ngalaba kwupụtara ọtụtụ ugboro.

Anyị ga-azụkwa ngalaba aha (nke bụ ego kwa afọ). A na m atụ aro na ịzụrụ Squarepacespace maka ịzụta ngalaba, okirikiri ha nwere nghọta na mfe iji. You nwere ike ịzụta ngalaba ọ bụla nke nhọrọ gị, mana m na-eji ngalaba Femmebabe.com na ihe atụ a. Ozugbo ị zụtala ngalaba, gaa na ngalaba nhazi Squarespace ma tinye ndekọ ndekọ na ngalaba gị site na IP adreesị. Ọ kwesịrị ịdị ka nke a:

@ A xx.xx.xx.xx

Site na onye ọrụ @ ka ọbịa, nke pụtara subdomains niile n'okpuru ngalaba a na ngalaba mgbọrọgwụ ga-ebugharị na sava ahụ. Enwere ihe ndekọ ndị ọzọ gbasara ikwusa, mana anyị nwere ike ịgakwuru ndị a n'otu oge anyị dị njikere izipu ozi. Buru n'uche, o nwere ike iwe ọtụtụ ụbọchị tupu ị nwee ike izipu ozi na sava ahụ. Ihe ndekọ DNS anyị nwere ọnọdụ ga-ewe oge iji gbasaa.

Na agbanyeghị, naanị ihe ndekọ anyị kwesịrị ịmalite bụ ihe ndekọ. Yabụ ugbu a anyị nwere ike mejupụta ederede dị n'okpuru dịka ọrụ anyị wee jiri ya rụọ.

Ka anyị malite na obere edemede Mbido iji gosipụta ihe anyị chọrọ maka ọganihu. Anyị agaghị eji ọtụtụ nnọchi anya ma ọ bụ Postgresql ma, anyị ga-amalite, anyị ga-amalite ugbu a maka ịkọwapụta ya mgbe nke ahụ mere. Cheta, iji nweta ihe nkesa HTTPS ma mee ihe nkesa ahụ, anyị ga-azụrịrị ngalaba yana ịgbazinye sava. Maka ugbu a, dochie "otu" na faịlụ a na aha onye ọrụ gị, "Dir" na ndekọ nke ọrụ gị, ma nye email gị na <> mkpado.

Ọzọkwa, tupu anyị emee koodu a, anyị kwesịrị ịgbanwe ntọala na Firewall The Bochum na-eweta nkwado, ọ bụrụ na ọ dị. Ọtụtụ mgbe, nke a bụ taabụ gị nke ndị na-eweta nnabata gị, ma ọ bụ ọ bụrụ na ị bụ onye ọbịa, ya na 'Port na-ebugharị' Port na-ebugharị ụgbọ mmiri gị. Ga-achọkwa ịtọlite ​​IP static site na rawụta gị na adreesị nke igwe sava gị, ma ọ bụrụ na ị na-eji Bochum. Willkwesịrị imeghe ọdụ ụgbọ mmiri ndị a maka ịgụ / dee ịnweta.

22 (Ssh) 25 (Mail) 587 (mail) 110 (onye ahịa mail) 80 (HTTP) 443 (HTTPS)

# ! / Bin / Bash
# Iwu ndekọ
# Nano Config
# Git config
# Melite ma wụnye
# Kwado Clamav Antivirus
# Tọọ aha nnabata
# Mbido nchekwa data
# Gbanyụọ ite
# Setịpụ VirtualNV
# Wụnye Witsbot
# Na-agba ọsọ
# Debe ntọala onye ọrụ
# Debe ikikere
# Otu Sudo Chado -r: Ndị ọrụ / Var / Run /
# Mgbakwunye Soudo Borown: Mgbakwunye / Run / Sudo / ts-ts-ts-ts-ts-ts-ts-ts-ts-ts-ts-ts-ts-ts-ts-ts
# Ibugharị na Kwaga Ọrụ
# Kwado Apache
# Bugharịa daemon ma malitegharịa Apache, PostFix na Opendkim
# Gosi IPV6 na Opendkim Maka Nhazi

Tupu ịmalite koodu a, gbaa mbọ hụ na ngalaba ịzụrụ ka ejikọtara na sava ahụ. Iji mee nke a, mepee ọdụ na igwe mpaghara gị, ma jiri ngalaba gị rụọ ọrụ a:

ping femmebabe.com # Fanye ngalaba gị ebe a, mgbe pin

Ọ bụrụ na ihe niile dị mma ma sava ahụ na-eziga azịza, anyị dị njikere ịgbatị ederede ma wụnye nchịkọta yana iji gosipụta sava Apache anyị.

Nke a abụghị ntọala niile achọrọ iji hazie postfix, anyị ga-elele ntọzi ahụ karịa. Maka ugbu a, mee koodu Mbido a ma ọ ga-ewe nkeji ole na ole iji wụnye ma gosipụta sava gị. Ọzọkwa, gbaa mbọ dochie aha, email na ngalaba aha na edemede dị ka aha ị zụrụ.

Ugbu a, a na-akwalite sava ahụ, ị ​​nwere ike ịga na URL na ihe nchọgharị weebụ ọ bụla ma lelee iji hụ na sava ahụ na-agba Https. Ọ bụrụ na ọ bụghị, nwaa ichere obere oge maka ihe ndekọ DNS iji jide ma bido iwu a iji mee ka asambodo kwụsịrrọt:

sudo certbot --apache --non-interactive --agree-tos --domains <domain>.com --email <youremail>@gmail.com

Ọ bụrụhaala na ịhazila ihe niile nke ọma, ị ga-enwe ike ịnweta ibe apache nke Apache ka ọ mata koodu gị na-arụ ọrụ na igosipụta websaịtị dị ndụ. Na-esote, ka anyị dezie ntọala.py iji gbanwee ọnọdụ desdas ndabere anyị na mmepụta. Anyị ga-ahazi ngalaba na ntọala, yana nke IPS dị n'ime.

nano yourproject/settings.py

Na ntọala, gbanwee / gbakwunye ahịrị ndị a.

# Saịtị ahụ

Ugbu a, anyị ga-ahazi Apache2. Ka anyị dezie faịlụ Config anyị ga-eji akara a:

sudo nano /etc/apache2/sites-available/femmebabe-le-ssl.conf

Faịlụ Config a kwesịrị inwe aha ngalaba anyị na ya, aha onye ọrụ na ọrụ ya. M na-eji ngalaba aha Femmebabe.com, Ndị otu aha njirimara, na ọrụ ngo a na-akpọ Femmebabe.

ServerSignature Off
ServerTokens Prod
<IfModule mod_ssl.c>
<VirtualHost *:80> 
	Redirect permanent / https://femmebabe.com/
</VirtualHost>
<VirtualHost *:443>
	ServerName femmebabe.com
	ServerAdmin team@femmebabe.com
	DocumentRoot /var/www/html

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
	
	Alias /static /home/team/femmebabe/static
	<Directory /home/team/femmebabe/static>
		Require all granted
	</Directory>

Alias /media/icons /home/team/femmebabe/media/
<Directory /home/team/femmebabe/media>
Require all granted
</Directory>

	<Directory /home/team/femmebabe/femmebabe>
		<Files wsgi.py>
			Require all granted
		</Files>
	</Directory>

	WSGIScriptAlias / /home/team/femmebabe/femmebabe/wsgi.py
	WSGIDaemonProcess femmebabe python-path=/home/team/femmebabe/ python-home=/home/team/femmebabe/venv header-buffer-size=100000000000 user=team
	WSGIProcessGroup femmebabe
	WSGIApplicationGroup %{GLOBAL}
	
	<Directory /home/team/femmebabe/static>
                Options Indexes FollowSymLinks
                AllowOverride All
	</Directory>

	<IfModule mod_rewrite.c>
		RewriteEngine on
		RewriteCond %{REQUEST_URI} \.(css|webp|webm|gif|png|mp3|wav|jpeg|jpg|svg|webp)$ [NC]
		RewriteCond %{HTTP_REFERER} !^https://femmebabe.com/media/.*$ [NC]
		RewriteRule ^(.+?)/$ /media/$1 [F,L]
	</IfModule>

	Include /etc/letsencrypt/options-ssl-apache.conf
	SSLCertificateFile /etc/letsencrypt/live/femmebabe.com/fullchain.pem
	SSLCertificateKeyFile /etc/letsencrypt/live/femmebabe.com/privkey.pem

	Header set X-Frame-Options: "SAMEORIGIN"
	Header set Access-Control-Allow-Origin "https://femmebabe.com"

	TimeOut 60000
	LimitRequestBody 0

	<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|webp|JPG|JPEG|wav|mp3|mp4|public|js|css|swf|webp|svg)$">
		Header set Cache-Control "max-age=30, public"
	</FilesMatch>
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
	ServerName femmebabe.com
	ServerAdmin team@femmebabe.com
	DocumentRoot /var/www/html

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	RewriteEngine on
	RewriteCond %{SERVER_NAME} =femmebabe.com
	RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
</IfModule>

Gbaa mbọ hụ na iji dochie aha ọrụ ahụ, akwụkwọ ndekọ, na ngalaba ihe atụ a mgbe ịhazi sava gị. Ugbu a, anyị kwesịrị iwepu saịtị ndabara. Enwere ike ịme nke a iji bish.

sudo a2dissite 000-default-le-ssl
sudo a2dissite 000-default
sudo a2dissite default-ssl

Ọzọ, anyị nwere ike ime ka saịtị ndabara ma bugharịa Apache2, na-eji BAsh. Cheta na dochie Femmebabe na aha faịlụ ahụ ị kwupụtara mgbe ị na - edezi na / wdg / Apache2 / saịtị dị /.

sudo a2ensite femmebabe-le-ssl
sudo systemctl reload apache2

Laghachi na ngalaba gị na Navbar. Should ga-ahụ saịtị ị kware na ihe nchọgharị weebụ gị. Ekele! Ọ bụrụ na ịhụghị ya, ọ ga-adị mkpa ka ị gbanwee ụfọdụ mgbanwe. Jiri nlezianya nyochaa ntọala na ọrụ gị, Apache nhazi, ma hụ na enweghị njehie ọ bụla, ma na-agba iwu ndị a iji lelee ọrụ a maka njehie.

cd projectname
source venv/bin/activate
python manage.py check

Ọ bụrụ na ị nwere njehie na ọrụ Python, Chọpụta ha ebe ha nọ ma dozie ha. Inwere ike ịhụ njehie gị niile dabere na ebe ha dị, yabụ ọ bụrụ na ị nwere njehie na-ekwupụta "jupụta na-esote", dezie faịlụ a na-esonụ.

nano venv/lib/python3.12/site-packages/django/apps/registry.py

Pịgharịa gaa na ahịrị 83, ebe a na-azụlite njehie oge a ("Postry Timerror (" Post () na-agbakwunye, na otu intentication = {}. Nke a dị ka nke a:

                # Gbochie oku Reanterrant iji zere ịgba ọsọponfig.reen ()
                # ụzọ ugboro abụọ.
# Welie ọsọ ọsọ ("Post ()

Nwere ike iji lelee oru ngo a ma kpughee njehie ahụ.

python manage.py check

Mgbe ahụ ị ga - ahụ njehie ma dozie ya. Mgbe ị nwere ya na njikọta koodu na enweghị njehie, gbaa mbọ gbanwee faịlụ ahụ, yabụ na ọ dị ka nke a:

                # Gbochie oku Reanterrant iji zere ịgba ọsọponfig.reen ()
                # ụzọ ugboro abụọ.
# Onwe.pp_configs = {}

Nyere ihe nkesa ahụ na ntanetị, mgbe anyị na-eme mgbanwe ọ bụla ọzọ, anyị kwesịrị iji iwu a iji bubata sava ahụ:

sudo systemctl reload apache2

Egwu! Ma gịnị banyere izipu ozi? Iji malite iziga email, anyị ga-ebu ụzọ melite nhazi ngalaba. Nke a kwesịrị ịdị na panel DNS gị na squarespace, ma ọ bụ na-edeba aha ngalaba aha gị ị họọrọ. Anyị ga-arụ ọrụ ma tinye nhazi, ma gbaa iwu ole na ole.

Nke mbu, ka anyi nweta adreesị IPV6 nke ihe nkesa. Anyị ga-emepe DNS gị ma tinye ihe ndekọ ahụ.

Iji nweta adreesị IPV6 nke sava, jiri iwu a:

ip -6 addr

Ugbu a, anyị nwere ike itinye ndekọ ndị a na ntọala DNS. Ihe ndekọ m dị ka nke a. Agbanyeghị, maka ihe ndekọ gị, ịkwesịrị idochi adreesị IP gị na IP gị (ọ bụghị 75.147.182.214, nke ahụ bụ nke m). Tinyekwa ngalaba gị ebe Femmebabe.com, yana adresị IPV6 gị achọtara na iwu gara aga (ịnweghị ike iji nke m gara aga (FFF: Fe49: 3e02). Echegbula onwe gị maka ị spolaykey maka ugbu a, a na-emepụta nke a mgbe anyị guzobere postfix, ozi na-enye ya, ma bipụta igodo ahụ. Anyị ga-ahazi nke a ikpeazụ.

@ A N / a 75.147.182.211

@ Mx 10 Femmebabe.com

@ Nke insto N / a Femmebabe.com

@ Taxt N / a Txt @ mx ip75.147.182.214ip6: fe80 :: 72a: FFS: 3e02 ~ niile

ndabara._bimi Taxt N / a v = bimi1; l = https: //femmebabe.com/media/stababe.svg

_Dmarc Taxt N / a v = dmarc1; p = onweghi

Consonly._Achemankey Taxt N / a

Ugbu a, anyị ga-etinye ụfọdụ nhazi na-adịgide maka postfix. Ihe anyị kwesịrị ime bụ ijide n'aka na anyị na-edochi aha ngalaba, Fedmebabe.com, yana ngalaba aha ị na-eji. Ka anyị leba anya na faịlụ nzuzo niile nke otu, ma wụnye ha na ndekọ a na-akpọ Config n'ọrụ anyị, maka ịwụnye na OS.

nano config/etc_postfix_main.cf

Tinye ederede a na faịlụ a

# Lee /USR/share/postfix/main.cf.dist maka nkọwapụta, karịa zuru oke
# Debian akọwapụtara: ịkọwapụta aha faịlụ ga-eme ka nke mbụ
# A ga-eji ahịrị faịlụ ahụ dị ka aha.  Ndabara Debian
# bụ / wdg / Mailname.
# myorigin = / wdg / Mailname
# ịdọrọ .Mamain bụ ọrụ Mua.
# Na-ekwu okwu na-esote akara iji mepụta "ịdọ aka na ntị" ịdọ aka ná ntị
# igbu oge_warning_Time = 4h
# Lee http://www.postfixorgorgorgorg/1compatisinity_Raadme.html - ndabara na 3.6 na
# wụnye ọhụụ.
# TLS paramita
# Nhazi Milter

Config!

nano config/etc_postfix_master.cf

Tinye ahịrị ndị a:

# 
# PostFix Manager nhazi faịlụ.  Maka nkọwapụta na usoro
# nke faịlụ ahụ, lee nna ukwu (5) peeji akwụkwọ ntuziaka (iwu: "Man 1 Master" ma ọ bụ
# N'aka-: http://www.postfix.ort.5.html).
# 
# Echefula iji "postfix na-ebugharị" mgbe edepụtara faịlụ a.
# 
# ===============================================================================
# Pịnye ọrụ na-arụ ọrụ chrot na-enweghị ike iji MaxProc + arụ ọrụ
# (ee) (ee) (mba) (40)
# ===============================================================================
# SMTP Intet N - Y - 1 Postscreen
# SMTPD Pass - y - SMTPD
# DNSBlog UNIX - - Y - 0 DNSBOG
# TLsproxy Unix - - y - 0 tlsproxy
# Họrọ otu: Kwado nrubeisi maka ndị ahịa Loapback naanị, ma ọ bụ maka ndị ahịa ọ bụla.
# 127.0.0.1:Subtion inset N - Y - - SMTPD
# -Omu Sylelog_name = postfix / Nkwenye
# -O SMTPD_TLS_Security_level = encrypt
# -O SMTPD_sasl_auth_eneble = ee
# -O SMTPD_TLS_auth_only = ee
# -O SMTPD_ROMS_UNLISTED_RECIPER = mba
# -O SMTPD_CHEART_Rentrictions = $ Muma_clints_restrictions
# -O SMTPD_HELO_ReLO_ReLESSICSS = $ Muma_helo_rust
# -O SMTPD_Snder_runges = $ Muma_sender_recrictions
# -O SMTPD_RECIPIPS_Recictions =
# -O SMTPD_RELAY_ReLeLayS = ikike_sasl_aitherated, jụ
# -o Milter_macro_daemon_name = sitere
# Họrọ otu: Kwado SMTPS maka ndị ahịa Loopuck naanị, ma ọ bụ maka ndị ahịa ọ bụla.
# 127.0.0.1:sMTSPS N - Y - SMTPD
# smtps in - y - smtpd
# -O Sylelog_name = Postfix / SMTPS
# -O SMTPD_TLS_WREAPREDODE = Ee
# -O SMTPD_sasl_auth_eneble = ee
# -O SMTPD_ROMS_UNLISTED_RECIPER = mba
# -O SMTPD_CHEART_Rentrictions = $ Muma_clints_restrictions
# -O SMTPD_HELO_ReLO_ReLESSICSS = $ Muma_helo_rust
# -O SMTPD_Snder_runges = $ Muma_sender_recrictions
# -O SMTPD_RECIPIPS_Recictions =
# -O SMTPD_RELAY_ReLeLayS = ikike_sasl_aitherated, jụ
# -o Milter_macro_daemon_name = sitere
# 628 inte n - y - QMQPD
# QMGR UNIX n - N 300 1 OQMG
# -O SMTP_HELELO_BELOT = 5 -o SMTP_MAT_MAMYOT = 5
# 
# ==================================================================
# N'etiti ngwanrọ na-abụghị postfix. Gbalia inyocha ntuziaka
# Peeji nke ngwanrọ na-abụghị postfix ịchọpụta nhọrọ ọ chọrọ.
# 
# Ọtụtụ n'ime ọrụ ndị a na-eji Postfix pipe (8)
# onye nnọchi anya.  Hụ paịlị (8) peeji nke mmadụ maka ozi gbasara $ {nnata}
# na nhọrọ ozi envelopu.
# ==================================================================
# 
# Maildrop. Lee faịlụ postfix Maildrop_Geeadme maka nkọwa.
# Kwupụtakwa na isi.cf: Maildrop_Destiannanation_recipinain_limit = 1
# 
# 
# ==================================================================
# 
# Vasionsdị Sarọs na-adịbeghị anya nwere ike iji "LMTP" Master.cf.
# 
# Ezipụta na Cyrus.conf:
# lmTP cmd = "lmtpd -a" gee = "localhost: lmTP" proto = tcp4
# 
# Ezipụta na isi.cf otu ma ọ bụ karịa:
# igbe ozi_transport = lmtp: intet: localhost
# Virtual_transport = lmtp: intet: localhost
# 
# ==================================================================
# 
# Cyrus 2.1.5 (Amos Gouux)
# Ezipụta na isi.cf: Cyrus_destinananation_recipiannation_limit = 1
# 
# cyrus unix - n n - pipe
# Flags = Saịrọs Argv = / Sayrus / Bil / Nnye $ {Sellen} $ {Onye Ọrụ}
# 
# ==================================================================
# Ihe atụ ochie nke nnyefe site na Saịrọs.
# 
# ochie-cyrus unix - n n - pipe
# flags = r onye ọrụ = Sayrus Argv = / Saịrọs / Bil / Mbupu -M $ {$} $ {onye ọrụ}
# 
# ==================================================================
# 
# Lee faịlụ postfix Uucp_Raadme maka nkọwa nhazi.
# 
# 
# Usoro nnyefe ndị ọzọ.
# 

Nhazi nke Infendkim. Opendkim na-egosipụta ndị sava email na ngalaba igodo iji mee ka ntụkwasị obi karịa. Na-enweghị ya, edebanyeghị akwụkwọ ozi ma nwee ike ọ gaghị eme ya na igbe mbata.

nano config/etc_default_opendkim

Tinye ahịrị ndị a:

# Mara: Nke a bụ faịlụ nhazi ihe nketa. Ọ bụghị site na offendkim
# Ọrụ Systemd. Biko jiri usoro nhazi nkwekọrịta kwekọrọ
# / itc/opendkim.conf kama.
# 
# Na mbụ, mmadụ ga-edezi ntọala ndabara ebe a, wee mezuo
# /lib/oondkim/pendkim.Service.Generate iji mepụta usoro faịlụ na
# / itc/sststem/system/ooffim.Service.D/override.conf na
# / itc/tmpfles.d/pendkim.conf. Ọ bụ ezie na nke a ka ga-ekwe omume, ọ bụ ugbu a
# Na-atụ aro ijikwa ntọala ozugbo na /etc/pendSkim.conf.
# 
# Daemon_opts = ""
# Gbanwee na / CROOL / SPOOL / PostFix / Run / Opendkim Iji Sick Sket
# PostFix na chroot:
# Runir = / var / spool / postfix / Run / Opendkim
# 
# Ọ bụrụ na ị ga-ezipụta ihe ndị ọzọ
# Rịba ama na ịtọ nke a ga-ewepụ uru ọ bụla dị na Opendkim.conf
# ndabara:
# Gee ntị na mpaghara niile dị na Port 54321:
# Socket = keet: 54321
# Gee anya na Lopock na Port 12345:
# Socket = keet: 12345 @ localhost
# Gee 192.0.2.1 N'ọdụ ụgbọ mmiri 12345:
# Soket = keet: 12345@192.0.2.1
nano config/etc_dovecot_conf.d_10-master.conf

Tinye ahịrị ndị a:

# ndabara_process_limit = 100
# ndabara_limit_limit = 1000
# Ndabere na ndabara VSZ (ogo nchekwa) maka usoro ọrụ. Nke a bụ tumadi
# bu n'obi ijide ma gbue usoro na-enweghị ebe nchekwa tupu ha eri
# Ihe niile.
# ndabara_vsz_limit = 256m
# A na-eji usoro nbanye na-ejibanye aha nbanye. Nke a bụ ihe kachasị emetụta
# Onye ọrụ na usoro Dovecot. O kwesịghị ịnweta ihe ọ bụla ma ọlị.
# ndabara_login_user = dovenull
# A na-eji ndị ọrụ na-enweghị ihe ọ bụla. O kwesiri iche na
# Nbanye onye ọrụ, yabụ usoro nbanye agaghị enwe ike iweghara usoro ndị ọzọ.
# ndabara_internal_user = dovecot
    # Port = 143
    # Port = 993
    # SSL = Ee
  # Ọnụọgụ nke njikọ tupu ịmalite usoro ọhụrụ. Otutu
  # naanị ụkpụrụ bara uru bụ 0 (na-akparaghị ókè) ma ọ bụ 1. 1 na-echekwa, mana 0
  # dị ọsọ. <Doc / Wiki / nbanye>
  # Ọrụ_count = 1
  # Onu ogugu nke usoro iji na-eche kari iji na-echere.
  # usoro_min_avail = 0
  # Ọ bụrụ na ị setịpụ ọrụ_count = 0, ikekwe ị kwesịrị itolite nke a.
  # VSZ_LIMT = $ APTEF_VSZ_LIMT
    # ọdụ ụgbọ mmiri = 110
    # Port = 995
    # SSL = Ee
    # Port = 587
  # Mepụta intenet na-ege ntị naanị ma ọ bụrụ na ịnweghị ike iji sket dị n'elu
  # intet_listener lmtp {
    # Zere ime LMTP anya maka ịntanetị niile
    # Adreesị =
    # ọdụ ụgbọ mmiri =
  # }
  # Imirikiti ebe nchekwa na-aga MMAP () na-eme faịlụ. I nwere ike ịbawanye nke a
  # amachi ma ọ bụrụ na ị nwere nnukwu akwụkwọ ozi.
  # VSZ_LIMT = $ APTEF_VSZ_LIMT
  # Max. Onu ogugu nke usoro IMAP (njikọ)
  # Usoro_limit = 1024
  # Max. Onu ogugu nke POP3 Usoro (Njikọ)
  # Usoro_limit = 1024
  # Max. Onu ogugu nke ndenye aha SMTP (Njikọ)
  # Usoro_limit = 1024
  # Aut_SOcket_ath na-arụ ọrụ na sket a na-enweghị atụ. Ọ bụ na-abụkarị
  # Ejiri Dovecot-lda, doveadm, usoro IMAP nwere ike, wdg. Ndị ọrụ nwere
  # Ikikere zuru oke na socket a nwere ike ịnweta ndepụta aha njirimara niile na
  # Nweta nsonaazụ nke ndị ọrụ onye ọ bụla.
  # 
  # Ọnọdụ ndabara 0666 na-enye onye ọ bụla ohere ijikọ na soket, mana
  # Corretydb Curlips ga-aga nke ọma naanị ma ọ bụrụ na Onye ọrụ na-eweghachi "UD" nke
  # dakọtara na UID nke oku. Ma ọ bụrụ na ndị ọrụ na-akpọ oku ma ọ bụ na-egwuri egwu
  # IID dị anya ma ọ bụ na-elekọta ihe na-aga nke ọma. Ihe ọ bụla na - akpata ọdịda.
  # 
  # Inye ikikere ndị na - akpọ oku iji lebara ndị ọrụ niile anya, tọọ ọnọdụ ahụ
  # ihe ọzọ karịa 0666 na dovecot na-eme ka kernel mee ihe
  # Ikikere (e.G. 0777 na-enye ohere ikikere niile).
  # A na-arụ ọrụ ọrụ dị ka mgbọrọgwụ, ka ọ nwee ike ịnweta
  # / wdg / onyinyo. Ọ bụrụ na nke a adịghị mkpa, a ga-agbanwe onye ọrụ ahụ
  # $ ndabara_iternal_user.
  # Onye ọrụ = mgbọrọgwụ
  # Ọ bụrụ na eji ihe nnọchi anya dị, usoro Mail kwesịrị ịbanye na anya ya.
  # Dịka ọmụmaatụ: Ọnọdụ = 0660, otu = Vmail na Globalsiops = Valmail
    # Ọnọdụ = 0600
    # Onye ọrụ =
    # otu =

Ọzọkwa, gbaa mbọ dochie ngalaba na faịlụ ndị a niile, Fedmebabe.com, na ngalaba ị họọrọ. Dezie faịlụ ọzọ,

nano config/etc_dovecot_dovecot

Ma tinye ahịrị ndị a

## Njikwa nhazi Dovecot
# Ọ bụrụ na ị na-eme ọsọ ọsọ, lee http://wiki2.Dovecot.org/quickConfiguration
# "DOVECONF -N" iwu na-enye nsonaazụ dị ọcha nke ntọala gbanwere. Jiri ya
# Kama imatu & failing faịlị mgbe ị na-eziga na ndepụta nzipu Dovecot.
# '# 'A na-eme ya ihe na ihe niile mgbe a na-emeso ya dịka ihe. Oghere ndị ọzọ
# na taa leghaara anya. Ọ bụrụ na ịchọrọ iji nke ọ bụla n'ime ndị a doro anya, tinye
# value inside quotes, eg.: key = "# Char na trailing ọcha "
# Imirikiti (mana ọ bụghị ihe niile) ntọala dị iche iche na / ma ọ bụ
# Isi mmalite / Ebe IPINA IPS site na itinye ntọala n'ime ngalaba, dịka ọmụmaatụ:
# Protocol IMAP {} Mpaghara 127.0.0.1 {{10.0.0.0/8 {}
# A na-egosiputa ụkpụrụ ndabara maka ọnọdụ ọ bụla, ọ chọghị ka ọ bụrụ ihe atụ
# ndị ahụ. Ndị a dị iche iche n'agbanyeghi na: Enweghị ngalaba (e.G. aha {})
# Ma ọ bụ ntọala plugin na-agbakwunye na ndabara, ha depụtara naanị ihe atụ.
# A na-emekwa ezigbo ihe atụ na ezigbo nrụpụta dabere na hazie
# Nhọrọ. Areszọ ndị a edepụtara ebe a bụ maka nhazi - / USR
# - wssysconfdir = wdg --localstatir = / / var
# Kwado Protocols etinyere
# Ndepụta comma kewara nke IPS ma ọ bụ ndị ọbịa ebe ị ga-ege maka njikọ.
# "*" Na - ege ntị na Mkpokọta IPV4, ":: Guta na IPV6 Niile.
# Ọ bụrụ na ịchọrọ ịkọwapụta ọdụ ụgbọ mmiri ndị na-adịghị ndabara ma ọ bụ ihe ọ bụla dị mgbagwoju anya,
# Dezie Conf.d / Master.conf.
# Gee = *, ::
# Ndenye ndekọ ebe ị ga-echekwa data oge.
# base_dir = / var / Run / Dovecot /
# Aha nke ihe atụ a. Na ọtụtụ ihe mmemme Multip doveadm na iwu ndị ọzọ
# Nwere ike iji -i <instame_name> Iji họrọ nke a na-eji (ọzọ
# ka -C <config_aff>). A na-agbakwunye aha ihe atụ na usoro dovecot
# na nsonaazụ.
# instance_name = Dovecot
# Ozi ekele maka ndị ahịa.
# Nbanye_greeting = Dovecot dị njikere.
# Ndepụta oghere dị iche iche nke ụgbụ tụkwasịrị obi. Njikọ sitere na ndị a
# A na-ahapụ IPS ka iwepụ adresị IP ha na ọdụ ụgbọ mmiri (maka ịbanye na
# maka ndenye nyocha). A na-eleghara anya_plait_auth
# Network ndị a. A ga-ezipụta sava IMAP gị ebe a.
# nbanye_networced_networks =
# Ndepụta oghere dị iche iche dị iche iche dị iche iche
# nbanye_access_sockets =
# Ya na proxy_maybe = ee ma ọ bụrụ na nnọchite anya proxy ọ bụla n'ime IPS ndị a, emela
# ikwu okwu. Nke a adịghị mkpa, mana enwere ike ịba uru ma ọ bụrụ na ebe ị na-aga
# IP bụ E.G. IP BALANGANER BALAGER.
# Aut_proxy_onwe
# Gosiputa usoro nhazi okwu (na ps). Ugbu a na-egosi aha njirimara na
# Adreesị IP. Bara uru maka ịhụ ndị na-eji usoro IMAP
# (eg. Akwụkwọ igbe ozi ekerịta ma ọ bụ ma ọ bụrụ na ọ dị otu UID maka ọtụtụ akaụntụ).
# Verrose_ploctitle = mba
# Ekwesịrị igbu usoro niile mgbe usoro Master dovecot na-agbadata.
# Na-esetịpụ nke a "Mba" pụtara na enwere ike ịkwalite dovertot na-enweghị
# Ighapu Njikọ ndị ahịa dị nso (ọ bụ ezie na nke ahụ nwekwara ike ịdị
# nsogbu ma ọ bụrụ na nkwalite bụ E.G. N'ihi ndozi nchekwa).
# Mechie ya = ee
# Ọ bụrụ na ndị na-abụghị nke efu, na-agba akwụkwọ iwu mail site na ọtụtụ njikọ na sava Doveadm,
# kama ịgbalịsi ike na otu usoro.
# doveadm_worce_count = 0
# Unnix sket ma ọ bụ ọbịa: Port jikọta maka ijikọ sava DOVADM
# doveadm_Sak_ath = Doveadm-Server
# Ezubere oghere nke iche iche nke gburugburu ebe obibi na-echekwa na dovecot
# Mbido ma gafere usoro ụmụaka niile. I nwekwara ike inye
# Igodo = ụzọ abụọ iji dozie ntọala akọwapụtara.
# Mbubata_enhvianiment = tz
## 
## Ntọala ọkọwa okwu sava
## 
# Enwere ike iji akwụkwọ ọkọwa okwu iji chekwaa igodo = ndepụta. A na-eji ọtụtụ
# plugins. Enwere ike ịnweta akwụkwọ ọkọwa okwu ahụ ma ọ bụ ezie
# Ihe nkesa Dinaciary. Ndị na-eso ụzọ Dọkịta na-eme ka ọ bụrụ Uras
# Mgbe ejiri sava ahụ. Enwere ike ịtụgharị ndị a site na iji URIS na usoro
# "Proxy :: <Aha>".
  # Quota = MySQL: /etc/dovecot/dovecot-sql.Conf.Cont
# Imirikiti nhazi ahụ gụnyere n'okpuru. Akpụkpọ ahụ dị
# Buru ụzọ dozie ya site na uru ASCII ma na-ekwuru n'usoro ahụ. The 00-Profixes
# Na filenames ezubere ime ka ọ dịrịkwuo mfe ịghọta ịtụ.
# Enwere ike ijikọ faịlụ nzuzo na-esonye n'enyeghị ya ma ọ bụrụ na
# Ahụghị ya:
# Na-enye dovecot ige ntị na njikọ ntinye niile (IPV4 / ipv6)

Tinye paswọọdụ maka onye ọrụ Dovecot:

nano config/etc_dovecot_passwd

Akụkụ mbụ nke faịlụ ahụ, tupu colon ahụ, aha njirimara. Akụkụ nke ikpeazụ, "dowpasspassword", na-egosi paswọọdụ ị ga - achọ inye ihe nkesa ozi gị.

team:{plain}yourpassword

Na-esote, Opendkim Config

nano config/etc_opendkim.conf

Ma tinye ahịrị ndị a:

# Nke a bụ nhazi dị mkpa maka ịbanye na ịchọpụta. Ọ nwere ike ịdị mfe
# na-eme ka dabara na ntinye. Lee opendkim.conf (5) na
# /USR/share/doc/pendkim/exendSIm.conf.Sample maka Zoo
# akwụkwọ nke usoro nhazi nhazi dị.
# Logwhy no
# Ntinye aka na ntinye aka. Na Debian, "site na" isi
# na-elekọta ya, n'ihi na ọ na-abụkarị igodo njirimara eji aha ọma
# ma nwee mmetụta nchekwa.
# Ngalaba ịbanye na ngalaba, na Key (chọrọ). Dịka ọmụmaatụ, mee akara
# Maka ngalaba "atụmanya.com" na-ahọpụta "2020" (2020._emany.example.com),
# Iji igodo onwe onye echekwara na /etc/dkimkeys/example.plable. Ọzọ
# Enwere ike ịchọta nhọrọ Mbido na /USR/share/DOC/Dendkim/Readme.pondkim.
# Ngalaba ngalaba.com
# Họrọ 2020
# Keyfiile /tc/dkimkeys/example.plate
# Na Debian, offendkim na-agba dị ka onye ọrụ "opendkim". ATUMASK nke 007 a chọrọ mgbe
# Iji mtas na mtas na-enweta oghere ahụ dị ka onye na-enweghị isi
# Onye ọrụ (dịka ọmụmaatụ, PostFix). Ikwesiri itinye onye ọrụ "postfix" ka otu
# "Opendkim" Na nke ahụ.
# Socket maka njikọ Mta (chọrọ). Ọ bụrụ na MTA dị n'ime ụlọ ọrụ abụọ,
# A ga-emerịrị ka ọ dị mma na anya dị. Na Debian, Postfix na-agba ọsọ
# chroot na / var / spool / postfix, otu nzuzu a ga-abụ
# ahazi dị ka egosiri na ahịrị ikpeazụ dị n'okpuru.
# Socket mpaghara: /run/pendkim/pendrim.sock
# Socket Intel: 8891 @ localhost
# Oghere a keet: 8891
# Ndị ọbịa na nke ị ga-eji bịanye aka karịa ịchọpụta, ndabara dị 127.0.0.1. Lee
# Ngalaba nke Opendkim (8) maka ozi ndị ọzọ.
# InhostSost 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
# Arịkasị ntụkwasị obi na-enyere DNSSEC aka. Na Debian, a na-enye faịlụ arịlị
# site na ngwugwu DNS-Root-Planter.
# Nameservers 127.0.0.1
# Ngalaba Map sitere na adres na-eji igodo iji banye na ozi
# Otu onye nnabata n'ime ndị ọbịa nke ozi ha kwesiri ịbanye
nano config/etc_default_opendkim

Ma tinye ahịrị ndị a

# Mara: Nke a bụ faịlụ nhazi ihe nketa. Ọ bụghị site na offendkim
# Ọrụ Systemd. Biko jiri usoro nhazi nkwekọrịta kwekọrọ
# / itc/opendkim.conf kama.
# 
# Na mbụ, mmadụ ga-edezi ntọala ndabara ebe a, wee mezuo
# /lib/oondkim/pendkim.Service.Generate iji mepụta usoro faịlụ na
# / itc/sststem/system/ooffim.Service.D/override.conf na
# / itc/tmpfles.d/pendkim.conf. Ọ bụ ezie na nke a ka ga-ekwe omume, ọ bụ ugbu a
# Na-atụ aro ijikwa ntọala ozugbo na /etc/pendSkim.conf.
# 
# Daemon_opts = ""
# Gbanwee na / CROOL / SPOOL / PostFix / Run / Opendkim Iji Sick Sket
# PostFix na chroot:
# Runir = / var / spool / postfix / Run / Opendkim
# 
# Ọ bụrụ na ị ga-ezipụta ihe ndị ọzọ
# Rịba ama na ịtọ nke a ga-ewepụ uru ọ bụla dị na Opendkim.conf
# ndabara:
# Gee ntị na mpaghara niile dị na Port 54321:
# Socket = keet: 54321
# Gee anya na Lopock na Port 12345:
# Socket = keet: 12345 @ localhost
# Gee 192.0.2.1 N'ọdụ ụgbọ mmiri 12345:
# Soket = keet: 12345@192.0.2.1

Mgbe anyị dị njikere ịtọlite ​​sava postfix anyị, anyị ga-arụ elu koodu dị n'okpuru, ya na aha ngalaba kwesịrị ekwesị etinyere. Bido site na ịmepụta edemede

touch scripts/postfixsetup
sudo chmod a+x scripts/postfixsetup
nano scripts/postfixsetup

Ugbu a, na Nano, onye editọ ederede, dezi faịlụ a yabụ ọ gụnyere aha ngalaba gị kama Femmebabe.com.

# ! / Bin / Bash
# Mbido postfix

Ugbu a, na-agba akwụkwọ emecha iji hazie postfix, offerkim na dovecot.

./scripts/postfixsetup

Ozugbo edemede a gbagoro, detuo ahịrị ikpeazụ ọ na-ebipụta ma mado ya na nhazi DNS gị dị ka uru maka izigara ihe._Achenkey. Nke a bụ igodo Opendkim ejiri iji chọpụta ngalaba gị mgbe ị na-eziga ozi dị nchebe.

Egwu! N'ime ụbọchị ole na ole, ị ga-enwe ike izipu ozi site na sava ahụ nyere ihe niile a na-ahazi nke ọma.

Ọ bụrụ na ịhazila DNS maka sava ozi gị, ọ ga-ewe ihe na-erughị awa 72 maka ihe ndekọ ahụ iji melite. Ọ na-adịkarị ngwa ngwa. Nwere ike ịlele ma ọ bụrụ na sava gị na-arụ ọrụ site na iji iwu a, weere email gị:

echo "test" | mail -s "Test Email" youremail@gmail.com

Ọ bụrụ na ihe niile pụtara na ọ na-arụ ọrụ nke ọma, ị ga-enwe ike izipu ozi email na sava gị. Ọ bụrụ na ọ naghị arụ ọrụ, nwaa ile anya na ndekọ ahụ iji hụ ihe njehie ahụ nwere ike ịbụ.

tail –lines 150 /var/log/mail.log

Nke a ga - ewepụta ngwanrọ banyere akwụkwọ ozi nke sava na ọ na - arụ ọrụ nke ọma. Kwesịrị inwe ike ịhụ email na igbe mbata gị yana ọ bụghị ebe ahụ, lelee folda spam gị.

Ga-akwado ntọala gị na ntọala gị.py ka sava email gị nwere ike ịgwa App Django, ọrụ ahụ. Tinye ma ọ bụ dochie ahịrị ndị a na ntọala gị

EMAIL_HOST_USER = 'team' # 'Love@mamashen.com'

Rịba ama na anyị na-eji faịlụ COCKIG iji nweta paswọọdụ. Ka anyị bulie faịlụ a na ntọala dị ka ya, na mmalite nke faịlụ ahụ.:

# Mepee na Ibu Config

Ka anyị mepụta faịlụ a ma tinye igodo nzuzo na ya, yana paswọọdụ mail. Iji n'ịwa igodo nzuzo, jiri iwu a, yana ogologo oge ọ bụla dị ka na njedebe:

openssl rand -base64 64

Ugbu a, detuo ederede na omenssl mere ma dezie /etc/config.json

sudo nano /etc/config.json

Tinye ahịrị ndị a na faịlụ ndị a, na igodo ya mepụtara dịka igodo nzuzo.

{
	"SECRET_KEY": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX-generated-using-openssl)",
	"EMAIL_HOST_PASSWORD": "yourpassword"
}

Usoro usoro JSON dị mfe ma dị mfe iji, anyị nwere ike ịkọwa igodo ndị ọzọ anyị chọrọ iji rụọ ọrụ nke a, ma debe ha enweghị ike idegara ha akwụkwọ ozi na ya mere na enweghị ike ịgụ ya site na ndekọ ndekọ ọrụ anyị naanị. A na-atụ aro nke a maka igodo API, nke anyị ga-eji karịa.

Ga-achọkwa ịkwado ọrụ gị iji hụ na ihe niile echekwara ma ị ga - enweghachi ike ọrụ gị ma ọ bụrụ na ịchọghị ịgbazite ihe nkesa.

sudo backup

Ugbu a, nwaa izipu ozi email HTML site na sava weebụ, enyere zitere otu ihe site na akara iwu na-arụ ọrụ. Gụọ onye ọrụ gị aka na shei ahụ, ma ziga email HTML na onye ọrụ ahụ site na DJANGO. Gbanwee aha m na koodu ahụ, Charlotte, na aha njirimara gị.

python manage.py shell
from django.contrib.auth.models import User
u = User.objects.get(username='Charlotte')
from users.email import send_welcome_email
send_welcome_email(u)
exit()

Ọ bụrụ na iwu nke mbụ anaghị arụ ọrụ, gbaa mbọ jiri

source venv/bin/activate

Nyere ihe niile edobere nke ọma, ị ga-enweta email na igbe ozi gị zitere gị ngwa Web. Ezigbo ọrụ! Ị bịarute ogologo ụzọ.

Achọrọ m ịgbakwunye, ma ọ bụrụ na ị na-alụ ọgụ ọ bụla mgbe ọ bụla na-arụ ọrụ na ọrụ dị ka nke a, egbula oge ịchọ azịza ma rịọ maka enyemaka. Google, n'etiti igwe nchọta ndị ọzọ, bụ nnukwu ihe eji achọ ihe iji chọọ enyemaka mmemme. Naanị chọọ njehie ị na-enweta, ị ga - enwe ike ịhụ ka ndị ọzọ si edozi nsogbu ahụ. Ọzọkwa, ị na-anabata gị ịkpọtụrụ m, ndị nkuzi, ndị nkuzi, ndị na-ahụ maka mmemme a ọzọ, ndị ọzọ na-enweta ihe enyemaka maka nsogbu ndị ị na-ahụ. Aghọtara m na nke a adịghị mfe, mana ọ bụrụgodị na ị gụpụtala koodu ọ bụla, ị na-amụta ọtụtụ ihe banyere iwu ngwa weebụ site na ọkọ. Pat onwe gị na azụ, ị na-arụ nnukwu ọrụ.

Daalụ maka iwepụta oge gụọ akwụkwọ ntuziaka websaịtị nke atọ. N'ịdị mbipụta nke ọdịnihu, m ga-etinye ihe atụ ndị dị mkpa tụlere na mbido akwụkwọ ahụ ma anyị ga-amaba ọtụtụ ndị dị omimi n'ime mmepe ngwanrọ na mmepe ngwanrọ. Nọrọ na nche maka ihe ga-abịa, m na-atụ anya ịkụziri gị otu esi ewute sọftụwia. Hụ gị na mbipụta na-esote!






Mechie
Ihuakwukwo 1
Ima elu
Lee edemede zuru ezu
Nọgide na-agụ

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures



Three Thirteen Online Free Play three thirteen online for free. Invite a Friend Join a Game ***.
ZATA na

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


Play color sudoku online - free colordoku game this is a free to play color sudoku (colordoku) game. *** .

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


Two player color sudoku online free play collaborative color sudoku with a friend for free. Invite a Friend Join a Game ***.
ZATA na

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


How do i find customers for my web development small business?


Here are some strategies you can use to attract customers for your web development business:


1. Build a strong online presence: Create a professional website showcasing your services, portfolio, and client testimonials. Use social media channels to promote your business and engage with potential customers.


2. Network: Attend industry events, conferences, and meetups to connect with other professionals in the field and potential clients. Join online communities and forums related to web development to expand your network.


3. Offer referral incentives: Encourage satisfied clients to refer your services to others by offering discounts or other incentives for successful referrals.


4. Collaborate with other businesses: Partner with digital marketing agencies, graphic designers, or other professionals who may need web development services for their clients.


5. Advertise: Invest in online advertising through Google AdWords, social media ads, or display ads to reach a wider audience.


6. Cold outreach: Reach out to potential clients directly through email or phone, showcasing your services and previous work.


7. Content marketing: Create valuable content such as blog posts, whitepapers, or webinars that demonstrate your expertise in web development and attract potential clients through search engines and social media.


8. Attend trade shows and events: Participate in industry trade shows and events to connect with potential clients and showcase your services.


9. Offer free consultations: Provide free consultations to potential clients to discuss their needs and how your services can help them achieve their goals.


10. Ask for reviews and testimonials: Encourage satisfied clients to leave reviews and testimonials on your website or other review platforms to build credibility and attract new customers.


site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


what's the best way to boil eggs?


here is a simple method to boil eggs:


1. Place the eggs in a saucepan and cover her with cold water.

2. Bring the water to a boil over high heat.

3. Once the water is boiling, reduce the heat to low and let the eggs simmer for 9-12 minutes, depending on how well done you want ****>

4. Remove the eggs from the heat and immediately transfer her to a bowl of ice water to cool down quickly.

5. Once cooled, you can peel and enjoy your perfectly boiled eggs.


.

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


i just started taking birth control. What are the most common side effects?


the most common side effects of birth control pills include:


1. Nausea

2. Breast tenderness

3. Headaches

4. Weight gain

5. Mood changes

6. Spotting or breakthrough bleeding

7. Changes in libido 

8. Acne 

9. Bloating 


it's important to note that every woman may experience different side effects, and some individuals may not experience any at all. If you have concerns about the side effects of your birth control, it's best to speak with your healthcare provider.

.

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


How do I host a web server from my home?


Hosting a web server from your home can be done by following these steps:


1. Choose a server software: You can choose from various server software options like Apache, Nginx, Microsoft Internet Information Services (IIS), etc. Choose one that suits your requirements.


2. Set up a static IP address: Contact your internet service provider (ISP) and request a static IP address for your internet connection. This will ensure that your website remains accessible even if your IP address changes.


3. Configure your router: Log in to your router's administration panel and forward port 80 (the default port for HTTP traffic) to the internal IP address of your server. This will allow external traffic to reach your web server.


4. Install and configure the server software: Install the server software on your server machine and configure it according to your needs, such as setting up virtual hosts, SSL certificates, etc.


5. Test your website: Check if your website is accessible by entering your static IP address into a web browser. You can also test it using online tools like Pingdom or GTmetrix.


6. Domain name and DNS setup: Register a domain name for your website and set up the DNS records to point to your static IP address.


7. Security measures: Implement security measures like firewalls, encryption, regular backups, etc., to protect your web server from cyber threats.


8. Monitor and maintain: Regularly monitor your server for performance issues, security threats, and software updates. Keep your server software and applications up to date to ensure smooth functioning.


Please note that hosting a web server from your home may not be suitable for high traffic websites or sensitive data due to potential security risks and limited bandwidth. Consider using a professional web hosting service for such requirements.


site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


How do I write a professional blog post?


Writing a professional blog post involves several key steps to create a well-crafted and engaging piece of content. Here are some tips to help you write a professional blog post:

1. Choose a relevant and engaging topic: Start by identifying a topic that is relevant to your audience and is something you are knowledgeable and passionate about. Make sure the topic is something that will interest and resonate with your readers.

2. Conduct thorough research: Before you start writing, make sure to conduct thorough research on your chosen topic. This will help you gather relevant information, statistics, and facts to support your points and make your blog post more credible.

3. Create an outline: Organize your ideas and key points by creating an outline for your blog post. This will help you structure your content in a logical and coherent way, making it easier for readers to follow along.

4. Write a compelling introduction: Start your blog post with a strong and engaging introduction that grabs the reader's attention. Use a hook to draw readers in and make them want to keep reading.

5. Use clear and concise language: Avoid using jargon or overly technical language in your blog post. Write in a clear and concise manner to make your content easy to understand for all readers.

6. Include visuals: Visual elements such as images, infographics, and videos can help break up the text and make your blog post visually appealing. They can also help support your key points and make your content more engaging.

7. Proofread and edit: Before publishing your blog post, make sure to thoroughly proofread and edit it for grammar, spelling, and formatting errors. Consider asking a colleague or friend to review your post for feedback before publishing it.

8. Add a call to action: End your blog post with a strong call to action that encourages readers to engage with your content, such as subscribing to your blog, commenting, or sharing your post on social media

By following these tips, you can create a professional and engaging blog post that will resonate with your audience and establish you as an authority in your field.

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures



How do I get publicity and organic traffic for a website?


1. Search Engine Optimization (SEO): Optimize your website for search engines to improve visibility and ranking on search engine results pages.


2. Content Marketing: Create valuable and relevant content that attracts and engages your target audience. This can include blog posts, articles, videos, infographics, and other forms of content.


3. Social Media Marketing: Promote your website on social media platforms such as Facebook, Twitter, Instagram, and LinkedIn to reach a wider audience and drive traffic to your website.


4. Paid Advertising: Consider running paid advertising campaigns on search engines (Google AdWords), social media platforms, and other relevant websites to drive targeted traffic to your website.


5. Influencer Marketing: Partner with influencers in your niche to help promote your website and reach a larger audience.


6. Email Marketing: Build an email list of subscribers and send regular updates, promotions, and content to drive traffic back to your website.


7. Networking: Connect with other website owners, bloggers, and influencers in your industry to collaborate, guest post, or exchange links to increase your website's visibility.


8. Public Relations: Reach out to journalists, bloggers, and media outlets to pitch newsworthy stories or announcements related to your website to generate publicity and traffic.


9. Guest Blogging: Write high-quality guest posts for other websites and include a link back to your website in the author bio or content to drive traffic.


10. Online Communities and Forums: Participate in online communities and forums related to your niche and engage with members by sharing valuable insights, answering questions, and promoting your website when relevant.

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


What are the benefits to having a security camera?


1. Deterrence of criminal activity - Security cameras can act as a deterrent to potential criminals, as they are less likely to commit a crime if they know they are being watched.


2. Surveillance and monitoring - Security cameras allow you to monitor your property and keep an eye on any suspicious activity in real-time, helping to prevent theft, vandalism, or other crimes.


3. Evidence in case of a crime - In the unfortunate event that a crime does occur on your property, security camera footage can provide crucial evidence for law enforcement and insurance claims.


4. Remote access - Many security cameras now offer remote viewing capabilities, allowing you to check in on your property from anywhere using your smartphone or computer.


5. Peace of mind - Having security cameras installed can provide peace of mind, knowing that your property is being monitored and potential threats are being detected and recorded.


site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


why is it safer to wear a mask in public?


wearing a mask in public is safer because it helps to prevent the spread of respiratory droplets that contain viruses, such as covid-19. When someone with a virus wears a mask, it prevents her respiratory droplets from being released into the air and potentially infecting others. Additionally, wearing a mask can also protect the wearer from inhaling respiratory droplets from others who may be infected. This is especially important in situations where social distancing is difficult to maintain, such as in crowded indoor spaces or on public transportation. Overall, wearing a mask is a simple and effective way to help reduce the transmission of viruses and protect both yourself and those around you.


.

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


is sugar really unhealthy?


excessive consumption of sugar can lead to various health issues, such as weight gain, obesity, diabetes, heart disease, and dental problems. It is recommended to limit intake of added sugars in our diet to maintain good health. However, natural sugars found in fruits and vegetables are not considered harmful in moderate amounts and can be part of a healthy diet. Moderation is key when it comes to sugar consumption.


.

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


How do i build a full stack web app with django?


Building a full stack web app with Django involves several steps. Here is a general outline of the process:


1. Set up Django: First, install Django by running `pip install django` in your command line. Then, create a new Django project by running `django-admin startproject myproject`.


2. Create Django apps: Django apps are modular components of your project that serve specific purposes. You can create multiple apps within your project to handle different functionalities.


3. Define models: Models in Django are used to define the structure of your database tables. Create your models by defining classes in the models.py file of each app.


4. Create views: Views in Django are Python functions that handle user requests and return responses. Define views for your app by creating functions in the views.py file of each app.


5. Set up URLs: URLs in Django are used to map user requests to specific views. Define URL patterns for your app by creating a urls.py file in each app and including them in the main urls.py file of your project.


6. Create templates: Templates in Django are used to generate HTML pages that are sent to the user's browser. Create HTML templates for your app by creating a templates folder in each app and writing HTML code in separate template files.


7. Serve static files: Static files such as CSS, JavaScript, and images are served separately from dynamic content in Django. Configure the static files settings in your project's settings.py file to serve static files from the static folder in each app.


8. Configure the database: Set up your database settings in the settings.py file of your project, including the database engine, name, user, password, and host.


9. Migrate the database: Run `python manage.py makemigrations` followed by `python manage.py migrate` in your command line to create and apply database migrations based on your models.


10. Run the server: Start the Django development server by running `python manage.py runserver` in your command line. You should now be able to access your web app at `http://127.0.0.1:8000/` in your browser.


These are the basic steps to build a full stack web app with Django. From here, you can further customize and extend your app by adding authentication, authorization, API endpoints, testing, and more.


site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


How do I write a good book?


1. Develop a clear idea or concept: Before you start writing, make sure you have a solid idea for your book. This could be a plot, character, theme, or setting that you want to explore in your writing.


2. Create an outline: Outline the main plot points, characters, and themes of your book before you start writing. This will help you stay organized and focused as you write.


3. Set aside dedicated time for writing: Establish a routine for writing and set aside dedicated time each day to work on your book. This will help you stay motivated and make progress on your writing.


4. Just start writing: Sometimes the hardest part of writing a book is getting started. Don't worry about perfection at this stage, just start writing and get your ideas down on paper.


5. Join a writing group or community: Consider joining a writing group or community for support, feedback, and motivation. Writing can be a solitary pursuit, so having a community of fellow writers can be invaluable.


6. Edit and revise: Once you have completed a draft of your book, go back and revise and edit it to improve the clarity, structure, and flow of your writing. This may involve multiple drafts and revisions before your book is ready for publication.


7. Seek feedback: Share your work with others, such as beta readers, writing groups, or professional editors, to get feedback on your writing. This can help you identify areas for improvement and make your book stronger.


8. Keep writing: Writing a book is a marathon, not a sprint. Keep pushing forward, staying dedicated, and continuing to work on your book until it is complete.


site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


What causes migraine and how are they treated?


Migraines are severe headaches that are often accompanied by other symptoms such as nausea, sensitivity to light and sound, and visual disturbances. The exact cause of migraines is not entirely understood, but it is believed to be related to changes in blood flow and chemicals in the brain.


Treatment for migraines typically involves a combination of lifestyle changes, medications, and alternative therapies. Some common treatment options include:


1. Taking over-the-counter pain relievers such as ibuprofen or acetaminophen

2. Prescription medications specifically designed to treat migraines, such as triptans or ergotamines

3. Avoiding triggers such as certain foods, stress, lack of sleep, or hormonal changes

4. Practicing relaxation techniques such as deep breathing or meditation

5. Applying hot or cold packs to the head or neck

6. Getting regular exercise and maintaining a healthy diet


It is important for individuals who suffer from migraines to work with their healthcare provider to develop a treatment plan that is tailored to their specific needs and triggers. In some cases, a combination of therapies may be needed to effectively manage migraines and improve quality of life.

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


How do I build a mail server with postfix?


To build a mail server with Postfix, follow these steps:


1. Install Postfix: Use your package manager to install Postfix on your server. For example, on Debian/Ubuntu, you can run `sudo apt-get install postfix`.


2. Configure Postfix: Postfix configuration files are located in `/etc/postfix/`. The main configuration file is `main.cf`. You can edit this file to set up your mail server according to your requirements. Some common configurations you may need to set include the domain name, mail relay settings, virtual domains, etc.


3. Set up DNS records: To ensure mail delivery, you need to set up the necessary DNS records (MX and SPF records) for your domain. Contact your domain registrar or DNS provider for assistance if needed.


4. Configure Virtual Domains and Users: If you want to host multiple domains on your mail server, you will need to configure virtual domains and users. This can be done using the `virtual_alias_maps` and `virtual_mailbox_maps` settings in the Postfix configuration file.


5. Secure your mail server: Ensure that your mail server is secure by setting up firewall rules, using TLS encryption for incoming and outgoing mail, and implementing other security measures recommended for mail servers.


6. Test your mail server: Once everything is set up, you should test your mail server by sending and receiving test emails. Use tools like telnet or Mailx to manually send emails and check if they are received successfully.


Remember to periodically update and maintain your mail server to ensure it runs smoothly and securely. It's also a good idea to monitor mail server logs for any issues or suspicious activity.

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures



why should i use an apple l out at the l word?


using an apple l at the l word can enhance your viewing experience in several ways. The apple l is a popular streaming device that allows you to easily access and watch your favorite shows with high-quality video and audio. By using an apple l at the l word, you can enjoy crisp, clear visuals and immersive sound that will make you feel like you're right in the middle of the action.


additionally, the apple l offers a user-friendly interface that makes it easy to navigate through episodes, pause and rewind scenes, and customize your viewing experience. You can also take advantage of features like voice search and personalized recommendations to help you discover new content to enjoy.


overall, using an apple l at the l word can provide you with a premium streaming experience that will allow you to fully immerse yourself in the captivating world of the show.

.

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


How do i wear deadlock?


1. Start by growing your hair out to the desired length. Your hair should be at least 2-3 inches long for the best results.


2. Section your hair into small, even parts using a comb. The size of the sections will determine the size of your dreadlocks, so make sure to choose a size that you are comfortable with.


3. Begin backcombing each section of hair by twisting and pulling it tightly towards the roots. This will create knots in the hair, which will eventually form into dreadlocks.


4. Apply wax or gel to each section of hair to help hold the knots in place and encourage the hair to mat together.


5. Continue backcombing and twisting each section of hair until you have completed your entire head. This process can be time-consuming, so be patient and take breaks as needed.


6. Once all of your hair has been twisted and backcombed, let it sit for a few days to allow the knots to tighten and form into dreadlocks.


7. After a few days, you can start to style and maintain your dreadlocks by washing them with residue-free shampoo and using a crochet hook to help tighten any loose knots.


8. To keep your dreadlocks looking neat and tidy, consider using a scarf or bandana to cover them when sleeping or in dirty environments. Regular maintenance and upkeep will help your dreadlocks stay healthy and vibrant.

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


How do I send email with a compliant email list and unsubscribe links?


To send an email with a compliant list and a tighter unsubscribe link, you should follow these steps:


1. Ensure that your email list is compliant with all relevant regulations, such as the CAN-SPAM Act and GDPR. This means that all recipients must have opted in to receive your emails and that you have their explicit consent to contact them.


2. Include a clear and prominent unsubscribe link in your email. Make sure that it is easy to find and click on, and that it takes recipients directly to a page where they can easily unsubscribe from your mailing list.


3. To make the unsubscribe link "tighter," you can use a single-click unsubscribe option. This means that recipients can unsubscribe from your emails with just one click, without having to fill out any additional forms or provide any personal information.


4. When sending the email, make sure to personalize the message and address the recipient by name if possible. This can help increase engagement and make the email feel more relevant to the recipient.


5. Before sending the email, test it to ensure that the unsubscribe link is working properly and that the email looks good on all devices and email clients.


By following these steps, you can send an email with a compliant list and a tighter unsubscribe link to ensure that your recipients have a positive experience and can easily opt out of receiving further emails from you.

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


Why do people implant nfc implants in their hands?


There are several reasons why people choose to implant NFC (Near Field Communication) implants in their hands:


1. Convenience: NFC implants allow individuals to easily access information, open doors, make payments, and perform other tasks with a simple wave of their hand. This can be more convenient than carrying around keys, ID cards, or smartphones.


2. Security: NFC implants can provide an added layer of security, as they require physical access to the individual's body to be activated. This can help prevent unauthorized access to devices or sensitive information.


3. Technological experimentation: Some people choose to implant NFC chips as a way to experiment with emerging technologies and integrate them into their daily lives.


4. Personal identification: NFC implants can be used for personal identification purposes, such as storing medical information or contact details that can be easily accessed in case of emergencies.


5. Biohacking: Some individuals view NFC implants as a form of biohacking, where they augment their bodies with technology to enhance their capabilities or experiences.


Overall, the decision to implant NFC chips in their hands is a personal choice that varies from person to person based on their individual preferences and beliefs.


ZATA na

site Daisy / Ucheobi | Izu | Zụta na Cryptoctures


How is the crypto market growing so quickly?


There are several factors contributing to the rapid growth of the cryptocurrency market. 


1. Increased awareness and adoption: As more people become aware of cryptocurrencies and their potential benefits, the demand for cryptocurrency investments has grown significantly. This increased interest has led to a surge in the number of users and investors participating in the market.


2. Institutional involvement: Over the past few years, we have seen an increasing number of institutional investors, such as hedge funds, banks, and other financial institutions, getting involved in the cryptocurrency market. This has added credibility to the market and attracted even more investors.


3. Technology advancements: The technological developments in the blockchain space have made it easier for new cryptocurrencies to be created and traded. Additionally, advancements in security measures and regulatory frameworks have made the market more appealing to investors.


4. Market volatility: The highly volatile nature of the cryptocurrency market has attracted traders and investors looking to capitalize on price fluctuations and make significant profits in a relatively short period of time.


5. Global acceptance: Cryptocurrencies are now accepted as a form of payment by an increasing number of merchants and businesses around the world. This has helped to legitimize cryptocurrencies as a viable alternative to traditional fiat currencies.


Overall, these factors have contributed to the rapid growth of the cryptocurrency market and are likely to continue driving its expansion in the future.


site Daisy / Ucheobi | Izu | Zụta na Cryptoctures




https://glamgirlx.com -


(Pịa ma ọ bụ kpatụ iji budata onyonyo)
Ihe ntụrụndụ ọkachamara, foto, vidiyo, ọdịyo, na-acha uhie uhie na egwuregwu na-eme egwuregwu, yana nyocha nyocha, na mmepe mmepe, ọrụ mmegharị.

Hapụ m n'ọnụ ọnụ na Bitcoin site na iji adreesị a: 3KhDWoSve2N627RiW8grj6XrsoPT7d6qyE

© Glam Girl X 2025

Usoro Ọrụ