diff options
132 files changed, 405 insertions, 5117 deletions
diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 176a458..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto @@ -343,3 +343,4 @@ pyblackbird_cc/media/ /pyblackbird_cc/static/scss/custom.css /pyblackbird_cc/static/bootstrap/scss/ .vscode +db.sqlite3 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 5e32d2a..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,39 +0,0 @@ -stages: - - lint - - test - -variables: - POSTGRES_USER: 'pyblackbird_cc' - POSTGRES_PASSWORD: '' - POSTGRES_DB: 'test_pyblackbird_cc' - POSTGRES_HOST_AUTH_METHOD: trust - CELERY_BROKER_URL: 'redis://redis:6379/0' - -precommit: - stage: lint - image: python:3.12 - variables: - PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit - cache: - paths: - - ${PRE_COMMIT_HOME} - before_script: - - pip install -q pre-commit - script: - - pre-commit run --show-diff-on-failure --color=always --all-files - -pytest: - stage: test - image: docker:25.0 - tags: - - docker - services: - - docker:dind - before_script: - - docker compose -f local.yml build - - docker compose -f docs.yml build - # Ensure celerybeat does not crash due to non-existent tables - - docker compose -f local.yml run --rm django python manage.py migrate - - docker compose -f local.yml up -d - script: - - docker compose -f local.yml run django pytest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index d3cb20e..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,49 +0,0 @@ -exclude: '^docs/|/migrations/|devcontainer.json' -default_stages: [commit] - -default_language_version: - python: python3.11 - -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-json - - id: check-toml - - id: check-xml - - id: check-yaml - - id: debug-statements - - id: check-builtin-literals - - id: check-case-conflict - - id: check-docstring-first - - id: detect-private-key - - - repo: https://github.com/adamchainz/django-upgrade - rev: '1.17.0' - hooks: - - id: django-upgrade - args: ['--target-version', '4.2'] - - # Run the Ruff linter. - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.4 - hooks: - # Linter - - id: ruff - args: [--fix, --exit-non-zero-on-fix] - # Formatter - #- id: ruff-format - - - repo: https://github.com/Riverside-Healthcare/djLint - rev: v1.34.1 - hooks: - - id: djlint-reformat-django - - id: djlint-django - -# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date -ci: - autoupdate_schedule: weekly - skip: [] - submodules: false diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt deleted file mode 100644 index 9861cf4..0000000 --- a/CONTRIBUTORS.txt +++ /dev/null @@ -1 +0,0 @@ -Matthew Lemon diff --git a/COPYING b/COPYING deleted file mode 100644 index 94a9ed0..0000000 --- a/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. @@ -1,59 +1,34 @@ -FROM docker.io/python:3.12.3-slim-bookworm as python +# Dockerfile for a Django project -FROM python as python-build-stage +FROM python:3.12-slim-bookworm -ARG BUILD_ENVIRONMENT=requirements +# The installer requires curl (and certificates) to download the release archive +RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && apt-get install libmagic-dev -y -RUN apt-get update && apt-get install --no-install-recommends -y \ - # dependencies for building Python packages - build-essential \ - # psycopg dependencies - libpq-dev +# Download the latest installer +ADD https://astral.sh/uv/install.sh /uv-installer.sh -COPY ./requirements.txt . -COPY ./wait-for-it.sh . -RUN chmod +x ./wait-for-it.sh +# Run the installer then remove it +RUN sh /uv-installer.sh && rm /uv-installer.sh -RUN pip wheel --wheel-dir /usr/src/app/wheels \ - -r ${BUILD_ENVIRONMENT}.txt +# Ensure the installed binary is on the `PATH` +ENV PATH="/root/.local/bin/:$PATH" +ADD . /app -FROM python as python-run-stage +# Set the working directory to /app +WORKDIR /app -ARG BUILD_ENVIRONMENT=production -ARG APP_HOME=/app +# Make port 8010 available to the world outside this container +EXPOSE 8020 -ENV PYTHONUNBUFFERED 1 -ENV PYTHONDONTWRITEBYTECODE 1 -ENV BUILD_ENV ${BUILD_ENVIRONMENT} +# Define environment variable +ENV DJANGO_SETTINGS_MODULE=config.settings.production +ENV DJANGO_READ_DOT_ENV_FILE=True +ENV DEBUG=False -WORKDIR ${APP_HOME} +RUN uv sync --frozen --no-dev && uv run manage.py collectstatic --noinput -RUN addgroup --system django \ - && adduser --system --ingroup django django - - -RUN apt-get update && apt-get install --no-install-recommends -y \ - libmagic1 \ - # psycopg dependencies - libpq-dev \ - # Translations dependencies - gettext \ - # cleaning up unused files - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* - -COPY --from=python-build-stage /usr/src/app/wheels /wheels/ - -RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \ - && rm -rf /wheels/ - -COPY --chown=django:django . ${APP_HOME} - -# make django owner of the WORKDIR directory as well. -RUN chown -R django:django ${APP_HOME} - -USER django - -RUN chmod +x docker-entrypoint.sh -ENTRYPOINT ["/app/docker-entrypoint.sh"] +# run gunicorn when the container launches +# CMD ["uv", "run", "gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8010"] +CMD ["uv", "run", "manage.py", "runserver", "0.0.0.0:8020"] @@ -1,38 +1,30 @@ -all: build run migrate collectstatic - -start: build run migrate collectstatic - -sass: - sass --no-source-map ~/code/python/alphabetlearning/alphabetlearning/static/scss/custom.scss ~/code/python/alphabetlearning/alphabetlearning/static/css/custom.css - -sync-env: - scp .env-prod substracker-web:code/alphabetlearning/.env - -build: - @docker build -f compose/production/django/Dockerfile -t alphabetlearning:latest . - -push: - @docker build -f compose/production/django/Dockerfile -t alphabetlearning:latest . && docker tag alphabetlearning registry.digitalocean.com/twentyfour-registry/pyblackbird && docker push registry.digitalocean.com/twentyfour-registry/pyblackbird - -clean-registry: - @doctl registry garbage-collection start --include-untagged-manifests twentyfour-registry - -run: - @docker run -d --rm --name alphabetlearning_django --env-file .env -p 8080:8080 alphabetlearning - -collectstatic: - @docker run --rm --env-file .env -v .:/app pyblackbird sh -c "python manage.py collectstatic --noinput" - -migrate: - @docker run --rm --env-file .env -v .:/app pyblackbird sh -c "python manage.py makemigrations && python manage.py migrate" - -clean: - @docker stop pyblackbird - @sleep 2 - @docker rmi pyblackbird +deploy-to-staging: +# Define variables +SERVER_USER = jo +SERVER_IP = jo.banded-neon.ts.net +PROJECT_DIR = /home/jo/alphabetlearning + +.PHONY: deploy + +run-development-server: + @echo "Running the development server..." + uv run manage.py runserver + +deploy-to-staging: + @echo "1. Pushing changes to remote repository..." + git push + @echo "2. Logging into the server and pulling latest changes..." + ssh $(SERVER_USER)@$(SERVER_IP) "cd $(PROJECT_DIR) && git pull" + @echo "3. Building the Docker image..." + ssh $(SERVER_USER)@$(SERVER_IP) "cd $(PROJECT_DIR) && docker compose build --no-cache" + @echo "4. Running the Docker container..." + ssh $(SERVER_USER)@$(SERVER_IP) "cd $(PROJECT_DIR) && docker compose up -d" + @echo "5. Migrating database..." + ssh $(SERVER_USER)@$(SERVER_IP) "cd $(PROJECT_DIR) && docker compose exec web uv run manage.py migrate" + @echo "Deployment completed!" test-all: - @pytest -q -s . + @uv run pytest -q -s . test: - @pytest -q -s -m "not slow" + @uv run pytest -q -s -m "not slow" diff --git a/alphabetlearning/contrib/sites/migrations/0001_initial.py b/alphabetlearning/contrib/sites/migrations/0001_initial.py index fd76afb..d6bb9e1 100644 --- a/alphabetlearning/contrib/sites/migrations/0001_initial.py +++ b/alphabetlearning/contrib/sites/migrations/0001_initial.py @@ -1,43 +1,32 @@ +# Generated by Django 5.1.4 on 2024-12-31 15:26 + import django.contrib.sites.models -from django.contrib.sites.models import _simple_domain_name_validator -from django.db import migrations -from django.db import models +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] + initial = True + + dependencies = [ + ] operations = [ migrations.CreateModel( - name="Site", + name='Site', fields=[ - ( - "id", - models.AutoField( - verbose_name="ID", - serialize=False, - auto_created=True, - primary_key=True, - ), - ), - ( - "domain", - models.CharField( - max_length=100, - verbose_name="domain name", - validators=[_simple_domain_name_validator], - ), - ), - ("name", models.CharField(max_length=50, verbose_name="display name")), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('domain', models.CharField(max_length=100, unique=True, validators=[django.contrib.sites.models._simple_domain_name_validator], verbose_name='domain name')), + ('name', models.CharField(max_length=50, verbose_name='display name')), ], options={ - "ordering": ("domain",), - "db_table": "django_site", - "verbose_name": "site", - "verbose_name_plural": "sites", + 'verbose_name': 'site', + 'verbose_name_plural': 'sites', + 'db_table': 'django_site', + 'ordering': ['domain'], }, - bases=(models.Model,), - managers=[("objects", django.contrib.sites.models.SiteManager())], + managers=[ + ('objects', django.contrib.sites.models.SiteManager()), + ], ), ] diff --git a/alphabetlearning/contrib/sites/migrations/0002_alter_domain_unique.py b/alphabetlearning/contrib/sites/migrations/0002_alter_domain_unique.py deleted file mode 100644 index 4a44a6a..0000000 --- a/alphabetlearning/contrib/sites/migrations/0002_alter_domain_unique.py +++ /dev/null @@ -1,21 +0,0 @@ -import django.contrib.sites.models -from django.db import migrations -from django.db import models - - -class Migration(migrations.Migration): - - dependencies = [("sites", "0001_initial")] - - operations = [ - migrations.AlterField( - model_name="site", - name="domain", - field=models.CharField( - max_length=100, - unique=True, - validators=[django.contrib.sites.models._simple_domain_name_validator], - verbose_name="domain name", - ), - ) - ] diff --git a/alphabetlearning/contrib/sites/migrations/0003_set_site_domain_and_name.py b/alphabetlearning/contrib/sites/migrations/0003_set_site_domain_and_name.py deleted file mode 100644 index f4b1cbb..0000000 --- a/alphabetlearning/contrib/sites/migrations/0003_set_site_domain_and_name.py +++ /dev/null @@ -1,63 +0,0 @@ -""" -To understand why this file is here, please read: - -http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django -""" -from django.conf import settings -from django.db import migrations - - -def _update_or_create_site_with_sequence(site_model, connection, domain, name): - """Update or create the site with default ID and keep the DB sequence in sync.""" - site, created = site_model.objects.update_or_create( - id=settings.SITE_ID, - defaults={ - "domain": domain, - "name": name, - }, - ) - if created: - # We provided the ID explicitly when creating the Site entry, therefore the DB - # sequence to auto-generate them wasn't used and is now out of sync. If we - # don't do anything, we'll get a unique constraint violation the next time a - # site is created. - # To avoid this, we need to manually update DB sequence and make sure it's - # greater than the maximum value. - max_id = site_model.objects.order_by("-id").first().id - with connection.cursor() as cursor: - cursor.execute("SELECT last_value from django_site_id_seq") - (current_id,) = cursor.fetchone() - if current_id <= max_id: - cursor.execute( - "alter sequence django_site_id_seq restart with %s", - [max_id + 1], - ) - - -def update_site_forward(apps, schema_editor): - """Set site domain and name.""" - Site = apps.get_model("sites", "Site") - _update_or_create_site_with_sequence( - Site, - schema_editor.connection, - "resources.joannalemon.com", - "pyblackbird-cc", - ) - - -def update_site_backward(apps, schema_editor): - """Revert site domain and name to default.""" - Site = apps.get_model("sites", "Site") - _update_or_create_site_with_sequence( - Site, - schema_editor.connection, - "example.com", - "example.com", - ) - - -class Migration(migrations.Migration): - - dependencies = [("sites", "0002_alter_domain_unique")] - - operations = [migrations.RunPython(update_site_forward, update_site_backward)] diff --git a/alphabetlearning/contrib/sites/migrations/0004_alter_options_ordering_domain.py b/alphabetlearning/contrib/sites/migrations/0004_alter_options_ordering_domain.py deleted file mode 100644 index f7118ca..0000000 --- a/alphabetlearning/contrib/sites/migrations/0004_alter_options_ordering_domain.py +++ /dev/null @@ -1,21 +0,0 @@ -# Generated by Django 3.1.7 on 2021-02-04 14:49 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ("sites", "0003_set_site_domain_and_name"), - ] - - operations = [ - migrations.AlterModelOptions( - name="site", - options={ - "ordering": ["domain"], - "verbose_name": "site", - "verbose_name_plural": "sites", - }, - ), - ] diff --git a/alphabetlearning/pages/apps.py b/alphabetlearning/pages/apps.py index cdd024b..768ce00 100644 --- a/alphabetlearning/pages/apps.py +++ b/alphabetlearning/pages/apps.py @@ -2,5 +2,5 @@ from django.apps import AppConfig class PagesConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'pages' + default_auto_field = "django.db.models.BigAutoField" + name = "alphabetlearning.pages" diff --git a/alphabetlearning/payments/migrations/0001_initial.py b/alphabetlearning/payments/migrations/0001_initial.py index 33b7602..136aef1 100644 --- a/alphabetlearning/payments/migrations/0001_initial.py +++ b/alphabetlearning/payments/migrations/0001_initial.py @@ -1,7 +1,7 @@ -# Generated by Django 5.0.4 on 2024-09-03 19:21 +# Generated by Django 5.1.4 on 2024-12-31 15:26 import django.db.models.deletion -from django.conf import settings +import uuid from django.db import migrations, models @@ -10,94 +10,78 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ("resources", "0019_alter_pdfpagesnapshot_options_and_more"), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('resources', '0001_initial'), ] operations = [ migrations.CreateModel( - name="ShoppingCart", + name='EmailSignup', fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("created_at", models.DateTimeField(auto_now_add=True)), - ("updated_at", models.DateTimeField(auto_now=True)), - ( - "user", - models.OneToOneField( - on_delete=django.db.models.deletion.CASCADE, - to=settings.AUTH_USER_MODEL, - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('email', models.EmailField(max_length=254, unique=True)), + ('date_added', models.DateTimeField(auto_now_add=True)), ], ), migrations.CreateModel( - name="Subscription", + name='EmailVerification', fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("is_active", models.BooleanField(default=False)), - ("start_date", models.DateTimeField(blank=True, null=True)), - ("end_date", models.DateTimeField(blank=True, null=True)), - ( - "stripe_subscription_id", - models.CharField(blank=True, max_length=255, null=True), - ), - ( - "user", - models.OneToOneField( - on_delete=django.db.models.deletion.CASCADE, - to=settings.AUTH_USER_MODEL, - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('email', models.EmailField(max_length=254, unique=True)), + ('verification_token', models.UUIDField(default=uuid.uuid4, editable=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('is_verified', models.BooleanField(default=False)), ], ), migrations.CreateModel( - name="CartItem", + name='Product', fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("quantity", models.PositiveIntegerField(default=1)), - ("added_at", models.DateTimeField(auto_now_add=True)), - ( - "resource", - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - to="resources.resource", - ), - ), - ( - "cart", - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - related_name="items", - to="payments.shoppingcart", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('stripe_product_id', models.CharField(max_length=100)), + ], + ), + migrations.CreateModel( + name='ShoppingCart', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ], + ), + migrations.CreateModel( + name='Subscription', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('is_active', models.BooleanField(default=False)), + ('start_date', models.DateTimeField(blank=True, null=True)), + ('end_date', models.DateTimeField(blank=True, null=True)), + ], + ), + migrations.CreateModel( + name='SubscriptionPlan', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('price', models.DecimalField(decimal_places=2, max_digits=6)), + ('description', models.TextField()), + ('allowed_downloads', models.PositiveIntegerField()), + ], + ), + migrations.CreateModel( + name='CartItem', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('added_at', models.DateTimeField(auto_now_add=True)), + ('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='resources.resource')), + ], + ), + migrations.CreateModel( + name='Price', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('price', models.IntegerField(default=0)), + ('stripe_price_id', models.CharField(max_length=100)), + ('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='price_obj', to='resources.resource')), ], - options={ - "unique_together": {("cart", "resource")}, - }, ), ] diff --git a/alphabetlearning/payments/migrations/0002_initial.py b/alphabetlearning/payments/migrations/0002_initial.py new file mode 100644 index 0000000..04df889 --- /dev/null +++ b/alphabetlearning/payments/migrations/0002_initial.py @@ -0,0 +1,46 @@ +# Generated by Django 5.1.4 on 2024-12-31 15:26 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('payments', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.AddField( + model_name='shoppingcart', + name='user', + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='cartitem', + name='cart', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='payments.shoppingcart'), + ), + migrations.AddField( + model_name='subscription', + name='user', + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='subscription', + name='plan', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='payments.subscriptionplan'), + ), + migrations.AlterUniqueTogether( + name='cartitem', + unique_together={('cart', 'resource')}, + ), + migrations.AddConstraint( + model_name='subscription', + constraint=models.UniqueConstraint(fields=('user', 'plan'), name='unique_user_plan'), + ), + ] diff --git a/alphabetlearning/payments/migrations/0002_subscriptionplan_and_more.py b/alphabetlearning/payments/migrations/0002_subscriptionplan_and_more.py deleted file mode 100644 index cab49b5..0000000 --- a/alphabetlearning/payments/migrations/0002_subscriptionplan_and_more.py +++ /dev/null @@ -1,36 +0,0 @@ -# Generated by Django 5.0.4 on 2024-09-03 19:32 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("payments", "0001_initial"), - ] - - operations = [ - migrations.CreateModel( - name="SubscriptionPlan", - fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("name", models.CharField(max_length=255)), - ("price", models.DecimalField(decimal_places=2, max_digits=6)), - ("description", models.TextField()), - ("allowed_downloads", models.PositiveIntegerField()), - ("stripe_plan_id", models.CharField(max_length=255)), - ], - ), - migrations.RemoveField( - model_name="subscription", - name="stripe_subscription_id", - ), - ] diff --git a/alphabetlearning/payments/migrations/0003_product_price.py b/alphabetlearning/payments/migrations/0003_product_price.py deleted file mode 100644 index b12d5dc..0000000 --- a/alphabetlearning/payments/migrations/0003_product_price.py +++ /dev/null @@ -1,53 +0,0 @@ -# Generated by Django 5.0.4 on 2024-09-04 19:01 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("payments", "0002_subscriptionplan_and_more"), - ] - - operations = [ - migrations.CreateModel( - name="Product", - fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("name", models.CharField(max_length=255)), - ("stripe_product_id", models.CharField(max_length=100)), - ], - ), - migrations.CreateModel( - name="Price", - fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("price", models.IntegerField(default=0)), - ("stripe_product_id", models.CharField(max_length=100)), - ( - "product", - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - to="payments.product", - ), - ), - ], - ), - ] diff --git a/alphabetlearning/payments/migrations/0004_rename_stripe_product_id_price_stripe_price_id.py b/alphabetlearning/payments/migrations/0004_rename_stripe_product_id_price_stripe_price_id.py deleted file mode 100644 index e5a339f..0000000 --- a/alphabetlearning/payments/migrations/0004_rename_stripe_product_id_price_stripe_price_id.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.4 on 2024-09-04 19:17 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ("payments", "0003_product_price"), - ] - - operations = [ - migrations.RenameField( - model_name="price", - old_name="stripe_product_id", - new_name="stripe_price_id", - ), - ] diff --git a/alphabetlearning/payments/migrations/0005_remove_subscriptionplan_stripe_plan_id.py b/alphabetlearning/payments/migrations/0005_remove_subscriptionplan_stripe_plan_id.py deleted file mode 100644 index 1e642b4..0000000 --- a/alphabetlearning/payments/migrations/0005_remove_subscriptionplan_stripe_plan_id.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 5.0.4 on 2024-09-08 19:23 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ("payments", "0004_rename_stripe_product_id_price_stripe_price_id"), - ] - - operations = [ - migrations.RemoveField( - model_name="subscriptionplan", - name="stripe_plan_id", - ), - ] diff --git a/alphabetlearning/payments/migrations/0006_subscription_plan.py b/alphabetlearning/payments/migrations/0006_subscription_plan.py deleted file mode 100644 index f54b5f9..0000000 --- a/alphabetlearning/payments/migrations/0006_subscription_plan.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 5.0.4 on 2024-09-08 20:21 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("payments", "0005_remove_subscriptionplan_stripe_plan_id"), - ] - - operations = [ - migrations.AddField( - model_name="subscription", - name="plan", - field=models.ForeignKey( - default=1, - on_delete=django.db.models.deletion.CASCADE, - to="payments.subscriptionplan", - ), - preserve_default=False, - ), - ] diff --git a/alphabetlearning/payments/migrations/0007_remove_cartitem_quantity_and_more.py b/alphabetlearning/payments/migrations/0007_remove_cartitem_quantity_and_more.py deleted file mode 100644 index e976059..0000000 --- a/alphabetlearning/payments/migrations/0007_remove_cartitem_quantity_and_more.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 5.0.4 on 2024-09-14 14:40 - -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('payments', '0006_subscription_plan'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.RemoveField( - model_name='cartitem', - name='quantity', - ), - migrations.AddConstraint( - model_name='subscription', - constraint=models.UniqueConstraint(fields=('user', 'plan'), name='unique_user_plan'), - ), - ] diff --git a/alphabetlearning/payments/migrations/0008_remove_price_product_price_resource.py b/alphabetlearning/payments/migrations/0008_remove_price_product_price_resource.py deleted file mode 100644 index 9d52284..0000000 --- a/alphabetlearning/payments/migrations/0008_remove_price_product_price_resource.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 5.0.4 on 2024-10-19 15:11 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('payments', '0007_remove_cartitem_quantity_and_more'), - ('resources', '0020_remove_resource_price_resource_stripe_product_id'), - ] - - operations = [ - migrations.RemoveField( - model_name='price', - name='product', - ), - migrations.AddField( - model_name='price', - name='resource', - field=models.ForeignKey(default=66, on_delete=django.db.models.deletion.CASCADE, related_name='price', to='resources.resource'), - preserve_default=False, - ), - ] diff --git a/alphabetlearning/payments/migrations/0009_emailsignup_alter_price_resource.py b/alphabetlearning/payments/migrations/0009_emailsignup_alter_price_resource.py deleted file mode 100644 index 4be05a2..0000000 --- a/alphabetlearning/payments/migrations/0009_emailsignup_alter_price_resource.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated by Django 5.0.4 on 2024-11-25 11:32 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('payments', '0008_remove_price_product_price_resource'), - ('resources', '0020_remove_resource_price_resource_stripe_product_id'), - ] - - operations = [ - migrations.CreateModel( - name='EmailSignup', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('email', models.EmailField(max_length=254, unique=True)), - ('date_added', models.DateTimeField(auto_now_add=True)), - ], - ), - migrations.AlterField( - model_name='price', - name='resource', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='price_obj', to='resources.resource'), - ), - ] diff --git a/alphabetlearning/payments/migrations/0010_pendingemailverification.py b/alphabetlearning/payments/migrations/0010_pendingemailverification.py deleted file mode 100644 index c49a2cb..0000000 --- a/alphabetlearning/payments/migrations/0010_pendingemailverification.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 5.0.4 on 2024-12-03 16:18 - -import uuid -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('payments', '0009_emailsignup_alter_price_resource'), - ] - - operations = [ - migrations.CreateModel( - name='PendingEmailVerification', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('email', models.EmailField(max_length=254)), - ('first_name', models.CharField(max_length=100)), - ('last_name', models.CharField(max_length=100)), - ('verification_token', models.UUIDField(default=uuid.uuid4, editable=False)), - ('created_at', models.DateTimeField(auto_now_add=True)), - ('is_verified', models.BooleanField(default=False)), - ], - ), - ] diff --git a/alphabetlearning/payments/migrations/0011_remove_pendingemailverification_first_name_and_more.py b/alphabetlearning/payments/migrations/0011_remove_pendingemailverification_first_name_and_more.py deleted file mode 100644 index e13f6d3..0000000 --- a/alphabetlearning/payments/migrations/0011_remove_pendingemailverification_first_name_and_more.py +++ /dev/null @@ -1,21 +0,0 @@ -# Generated by Django 5.0.4 on 2024-12-03 16:38 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('payments', '0010_pendingemailverification'), - ] - - operations = [ - migrations.RemoveField( - model_name='pendingemailverification', - name='first_name', - ), - migrations.RemoveField( - model_name='pendingemailverification', - name='last_name', - ), - ] diff --git a/alphabetlearning/payments/migrations/0012_rename_pendingemailverification_emailverification.py b/alphabetlearning/payments/migrations/0012_rename_pendingemailverification_emailverification.py deleted file mode 100644 index 770aee5..0000000 --- a/alphabetlearning/payments/migrations/0012_rename_pendingemailverification_emailverification.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 5.0.4 on 2024-12-03 17:23 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('payments', '0011_remove_pendingemailverification_first_name_and_more'), - ] - - operations = [ - migrations.RenameModel( - old_name='PendingEmailVerification', - new_name='EmailVerification', - ), - ] diff --git a/alphabetlearning/payments/migrations/0013_alter_emailverification_email.py b/alphabetlearning/payments/migrations/0013_alter_emailverification_email.py deleted file mode 100644 index 5d537bb..0000000 --- a/alphabetlearning/payments/migrations/0013_alter_emailverification_email.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.4 on 2024-12-05 16:16 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('payments', '0012_rename_pendingemailverification_emailverification'), - ] - - operations = [ - migrations.AlterField( - model_name='emailverification', - name='email', - field=models.EmailField(max_length=254, unique=True), - ), - ] diff --git a/alphabetlearning/payments/views.py b/alphabetlearning/payments/views.py index 7682c35..cdfafe6 100644 --- a/alphabetlearning/payments/views.py +++ b/alphabetlearning/payments/views.py @@ -1,31 +1,19 @@ -import requests import stripe +from alphabetlearning.payments.models import EmailSignup, EmailVerification +from alphabetlearning.resources.models import Resource +from alphabetlearning.users.models import User from django.conf import settings from django.contrib.auth.decorators import login_required -from django.core.mail import mail_admins -from django.core.mail import send_mail -from django.http import HttpResponse -from django.http import HttpResponseBadRequest -from django.shortcuts import get_object_or_404 -from django.shortcuts import redirect -from django.shortcuts import render -from django.urls import reverse -from django.urls import reverse_lazy +from django.core.mail import mail_admins, send_mail +from django.http import HttpResponse, HttpResponseBadRequest +from django.shortcuts import get_object_or_404, redirect, render +from django.urls import reverse, reverse_lazy from django.views import View from django.views.decorators.csrf import csrf_exempt -from django.views.generic import DeleteView -from django.views.generic import TemplateView -from django_ratelimit.decorators import ratelimit - -from alphabetlearning.payments.models import EmailSignup -from alphabetlearning.payments.models import EmailVerification -from alphabetlearning.resources.models import Resource -from alphabetlearning.users.models import User +from django.views.generic import DeleteView, TemplateView from .forms import EmailVerificationForm -from .models import CartItem -from .models import Price -from .models import ShoppingCart +from .models import CartItem, Price, ShoppingCart # TODO get the cart integrated with Stripe # Steps to convert our Cart into something that can be used with Stripe: @@ -58,11 +46,8 @@ class SuccessEmailSignupView(TemplateView): return context -@ratelimit(key="ip", rate="2/m", block=True) def email_signup_verification(request): if request.method == "POST": - if getattr(request, "limited", False): - return render(request, "payments/rate_limited.html", status=429) form = EmailVerificationForm(request.POST) if form.is_valid(): # Create pending verification @@ -75,41 +60,27 @@ def email_signup_verification(request): "payments:verify_email", args=[str(pending_verification.verification_token)] ) ) - # email = process_verification_emails( - # email=form.cleaned_data.get("email"), - # verification_url=verification_url, - # ) - email = send_mailgun_verification(form.cleaned_data.get("email"), verification_url) + email = send_verification_email(form.cleaned_data.get("email"), verification_url) return render(request, "payments/verification_sent.html", {"email": email}) else: - # email = process_verification_emails(email=request.POST.get("email"), warn=True) - email = send_mailgun_verification(email=request.POST.get("email"), warn=True) + email = send_verification_email(email=request.POST.get("email"), warn=True) return render(request, "payments/verification_sent.html", {"email": email}) else: form = EmailVerificationForm() return render(request, "pages/home.html", {"form": form}) # Adjust as necessary -def send_mailgun_verification( - email: str, - verification_url: str = None, - warn=False, -): +def send_verification_email(email: str, verification_url: str = None, warn=False): if warn: warning_message = """ You are already subscribed to our list - no further action is required. """ - requests.post( - f"{settings.MAILGUN_API_URL}/{settings.MAILGUN_SENDER_DOMAIN}/messages", - auth=("api", settings.MAILGUN_API_KEY), - data={ - "from": f"No reply - Alphabet Learning <noreply@{settings.MAILGUN_SENDER_DOMAIN}>", - "to": [ - email, - ], - "subject": "Alphabet Learning - Email Verification", - "text": f"Thanks, {email} for signing up.\n\n{warning_message}\n\nBest regards,\n\nThe Alphabet Learning Team", - }, + send_mail( + subject="Alphabet Learning - Email Verification", + message=f"Thanks, {email} for signing up.\n\n{warning_message}\n\nBest regards,\n\nThe Alphabet Learning Team", + from_email=settings.DEFAULT_FROM_EMAIL, + recipient_list=[email], + fail_silently=False, ) else: warning_message = f""" @@ -117,94 +88,16 @@ def send_mailgun_verification( {verification_url} If you didn't request this, please ignore this email. """ - requests.post( - f"{settings.MAILGUN_API_URL}/{settings.MAILGUN_SENDER_DOMAIN}/messages", - auth=("api", settings.MAILGUN_API_KEY), - data={ - "from": f"No reply - Alphabet Learning <noreply@{settings.MAILGUN_SENDER_DOMAIN}>", - "to": [ - email, - ], - "subject": "Alphabet Learning - Email Verification", - "text": f"Thanks, {email} for signing up.\n\n{warning_message}\n\nBest regards,\n\nThe Alphabet Learning Team", - }, + send_mail( + subject="Alphabet Learning - Email Verification", + message=f"Thanks, {email} for signing up.\n\n{warning_message}\n\nBest regards,\n\nThe Alphabet Learning Team", + from_email=settings.DEFAULT_FROM_EMAIL, + recipient_list=[email], + fail_silently=False, ) return email -def process_verification_emails( - email: str, - verification_url: str = None, - warn=False, -): - if warn is False: - html_warning_message = f""" - <p>Please click the following link to verify your email address within 24 hours:</p> - <p><a href="{verification_url}">{verification_url}</a></p> - <p>If you didn't request this, please ignore this email.</p> - """ - warning_message = f""" - Please click the following link to verify your email address within 24 hours: - {verification_url} - If you didn't request this, please ignore this email. - """ - admin_warn = "They are not already subscribed." - else: - html_warning_message = """ - <p>You are already subscribed to our list - no further action is required.</p> - """ - warning_message = """ - You are already subscribed to our list - no further action is required. - """ - admin_warn = "They have already subscribed so have been told of this fact in their verification email. No further action required." - - # Send verification email - subject = "Alphabet Learning - Email Verification" - html_message = f""" - <html> - <body> - <p>Hi!</p> - <p>You recently requested to sign up to the Alphabet Learning contact list.</p> - {html_warning_message} - <p>Best regards,</p> - <p>The Alphabet Learning Team</p> - </body> - </html> - """ - message = f""" - Hi!, - - You recently requested to sign up to the Alphabet Learning contact list. - - {warning_message} - - Best regards, - The Alphabet Learning Team - """ - send_mail( - subject, - message, - settings.DEFAULT_FROM_EMAIL, - [email], - fail_silently=False, - html_message=html_message, - ) - admin_message = f""" - Joanna/Matthew, - - {email} has just signed up to the Alphabet Learning contact list. They are awaiting verification. - - {admin_warn} - - I will email again if they follow through with the verification. - - Best regards, - The Alphabet Learning Server - """ - mail_admins(subject, admin_message, fail_silently=False) - return email - - def verify_email(request, token): try: pending = EmailVerification.objects.get(verification_token=token, is_verified=False) diff --git a/alphabetlearning/resources/factories.py b/alphabetlearning/resources/factories.py index 4075ab1..47d86e2 100644 --- a/alphabetlearning/resources/factories.py +++ b/alphabetlearning/resources/factories.py @@ -2,11 +2,8 @@ import itertools import factory -from .models import PDFPageSnapshot -from .models import PDFResource -from .models import Resource -from .models import ResourceCategory -from .models import ResourceType +from .models import (PDFPageSnapshot, PDFResource, Resource, ResourceCategory, + ResourceType) class ResourceTypeModelFactory(factory.django.DjangoModelFactory): @@ -39,7 +36,7 @@ class ResourceModelFactory(factory.django.DjangoModelFactory): model = Resource name = factory.Sequence(lambda n: f"Default Resource {n}") - price = factory.Faker("pydecimal", left_digits=4, right_digits=2, positive=True) + # price = factory.Faker("pydecimal", left_digits=4, right_digits=2, positive=True) thumbnail_filenames = factory.List( [factory.Faker("file_name", extension="jpg") for _ in range(3)] ) diff --git a/alphabetlearning/resources/migrations/0001_initial.py b/alphabetlearning/resources/migrations/0001_initial.py index 812c98f..9112f51 100644 --- a/alphabetlearning/resources/migrations/0001_initial.py +++ b/alphabetlearning/resources/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.0.4 on 2024-05-13 21:41 +# Generated by Django 5.1.4 on 2024-12-31 15:26 import django.db.models.deletion from django.db import migrations, models @@ -19,16 +19,22 @@ class Migration(migrations.Migration): ('file_name', models.CharField(max_length=255)), ('file_size', models.IntegerField()), ], + options={ + 'verbose_name_plural': 'PDF Resources', + }, ), migrations.CreateModel( name='Resource', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), + ('stripe_product_id', models.CharField(max_length=100)), ('thumbnail_filenames', models.JSONField(default=list, verbose_name='Thumbnail filenames')), - ('description', models.TextField(max_length=1000)), - ('age_range', models.CharField(choices=[('3-5', '3-5'), ('5-7', '5-7'), ('7-11', '7-11'), ('11-14', '11-14'), ('14-16', '14-16'), ('16+', '16+'), ('Age not applicable', 'Age not applicable')], default='5-7', max_length=20)), + ('description', models.TextField(help_text='\n <strong>Markdown acceptable here!</strong>This is your opportunity to clearly explain what\n your resource is all about! It’s worth remembering that you are using the space to\n communicate to two different audiences. Firstly, think about what fellow teachers\n would like to know, such as exactly what the resource contains and how it could be used in\n the classroom. Secondly, the words you include on this page are also talking to internal and\n external search engines. External search engines, like Google, show the first 155 characters\n of the resource description, so make sure you take advantage\n of these characters by using lots of relevant keywords as part of an enticing pitch.\n', max_length=5000)), + ('card_description', models.TextField(blank=True, default='', help_text="If you enter text here, it will be used in the 'card' description box on the home page. Max 1000 characters.", max_length=1000)), + ('age_range', models.CharField(choices=[('Preschool (3-4yrs)', 'Preschool (3-4yrs)'), ('Nursery (2-5yrs)', 'Nursery (2-5yrs)'), ('Reception (4-5yrs)', 'Reception (4-5yrs)'), ('Year 1 (5-6yrs)', 'Year 1 (5-6yrs)'), ('Year 2 (6-7yrs)', 'Year 2 (6-7yrs)'), ('Early Years (0-5yrs)', 'Early Years (0-5yrs)'), ('Keystage 1 (5-7yrs)', 'Keystage 1 (5-7yrs)'), ('Keystage 2 (7-11yrs)', 'Keystage 2 (7-11yrs)'), ('Age not applicable', 'Age not applicable')], default='5-7', max_length=20)), ('curriculum', models.CharField(blank=True, choices=[('No curriculum', 'No curriculum'), ('English', 'English'), ('Scottish', 'Scottish')], default='English', max_length=20, null=True)), + ('feature_slot', models.IntegerField(blank=True, choices=[(1, 1), (2, 2), (3, 3)], default=0, null=True, unique=True)), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ], @@ -40,12 +46,26 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=255)), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), + ('colour_css_class', models.CharField(blank=True, max_length=56, null=True)), + ('badge_foreground_colour', models.CharField(blank=True, max_length=56, null=True)), ], options={ 'verbose_name_plural': 'Resource Categories', }, ), migrations.CreateModel( + name='ResourceSubcategory', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ], + options={ + 'verbose_name_plural': 'Resource Subcategories', + }, + ), + migrations.CreateModel( name='ResourceType', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), @@ -53,6 +73,9 @@ class Migration(migrations.Migration): ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ], + options={ + 'verbose_name_plural': 'Resource Types', + }, ), migrations.CreateModel( name='PDFPageSnapshot', @@ -62,6 +85,9 @@ class Migration(migrations.Migration): ('file_name', models.CharField(max_length=255)), ('pdf_file', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pdf_page_snapshots', to='resources.pdfresource')), ], + options={ + 'verbose_name_plural': 'PDF Page Snapshots', + }, ), migrations.AddField( model_name='pdfresource', @@ -70,13 +96,13 @@ class Migration(migrations.Migration): ), migrations.AddField( model_name='resource', - name='additional_resource_category', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='additional_resource_category', to='resources.resourcecategory'), + name='main_resource_category', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='main_resource_category', to='resources.resourcecategory'), ), migrations.AddField( model_name='resource', - name='main_resource_category', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='main_resource_category', to='resources.resourcecategory'), + name='subcategories', + field=models.ManyToManyField(blank=True, related_name='additional_resource_category', to='resources.resourcesubcategory'), ), migrations.AddField( model_name='resource', diff --git a/alphabetlearning/resources/migrations/0002_alter_resource_additional_resource_category_and_more.py b/alphabetlearning/resources/migrations/0002_alter_resource_additional_resource_category_and_more.py deleted file mode 100644 index 3b70450..0000000 --- a/alphabetlearning/resources/migrations/0002_alter_resource_additional_resource_category_and_more.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 5.0.4 on 2024-05-15 20:00 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('resources', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='resource', - name='additional_resource_category', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='additional_resource_category', to='resources.resourcecategory'), - ), - migrations.AlterField( - model_name='resource', - name='curriculum', - field=models.CharField(blank=True, choices=[('No curriculum', 'No curriculum'), ('English', 'English'), ('Scottish', 'Scottish')], default='English', max_length=20), - ), - ] diff --git a/alphabetlearning/resources/migrations/0002_resource_price.py b/alphabetlearning/resources/migrations/0002_resource_price.py new file mode 100644 index 0000000..899be2c --- /dev/null +++ b/alphabetlearning/resources/migrations/0002_resource_price.py @@ -0,0 +1,18 @@ +# Generated by Django 5.1.4 on 2025-01-06 17:13 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('resources', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='resource', + name='price', + field=models.DecimalField(decimal_places=2, default=0.0, max_digits=6), + ), + ] diff --git a/alphabetlearning/resources/migrations/0003_alter_resource_description.py b/alphabetlearning/resources/migrations/0003_alter_resource_description.py deleted file mode 100644 index f0ed99c..0000000 --- a/alphabetlearning/resources/migrations/0003_alter_resource_description.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.4 on 2024-05-16 11:33 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('resources', '0002_alter_resource_additional_resource_category_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='resource', - name='description', - field=models.TextField(help_text='\n <strong>Markdown acceptable here!</strong>This is your opportunity to clearly explain what\n your resource is all about! It’s worth remembering that you are using the space to\n communicate to two different audiences. Firstly, think about what fellow teachers\n would like to know, such as exactly what the resource contains and how it could be used in\n the classroom. Secondly, the words you include on this page are also talking to internal and\n external search engines. External search engines, like Google, show the first 155 characters\n of the resource description, so make sure you take advantage\n of these characters by using lots of relevant keywords as part of an enticing pitch.\n', max_length=5000), - ), - ] diff --git a/alphabetlearning/resources/migrations/0003_remove_resource_price.py b/alphabetlearning/resources/migrations/0003_remove_resource_price.py new file mode 100644 index 0000000..3bcd707 --- /dev/null +++ b/alphabetlearning/resources/migrations/0003_remove_resource_price.py @@ -0,0 +1,17 @@ +# Generated by Django 5.1.4 on 2025-01-06 19:40 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('resources', '0002_resource_price'), + ] + + operations = [ + migrations.RemoveField( + model_name='resource', + name='price', + ), + ] diff --git a/alphabetlearning/resources/migrations/0004_resource_feature_slot_1_resource_feature_slot_2_and_more.py b/alphabetlearning/resources/migrations/0004_resource_feature_slot_1_resource_feature_slot_2_and_more.py deleted file mode 100644 index d595b62..0000000 --- a/alphabetlearning/resources/migrations/0004_resource_feature_slot_1_resource_feature_slot_2_and_more.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated by Django 5.0.4 on 2024-05-22 19:24 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('resources', '0003_alter_resource_description'), - ] - - operations = [ - migrations.AddField( - model_name='resource', - name='feature_slot_1', - field=models.IntegerField(choices=[(1, 1), (2, 2), (3, 3)], null=True, unique=True), - ), - migrations.AddField( - model_name='resource', - name='feature_slot_2', - field=models.IntegerField(choices=[(1, 1), (2, 2), (3, 3)], null=True, unique=True), - ), - migrations.AddField( - model_name='resource', - name='feature_slot_3', - field=models.IntegerField(choices=[(1, 1), (2, 2), (3, 3)], null=True, unique=True), - ), - ] diff --git a/alphabetlearning/resources/migrations/0005_rename_feature_slot_1_resource_feature_slot_and_more.py b/alphabetlearning/resources/migrations/0005_rename_feature_slot_1_resource_feature_slot_and_more.py deleted file mode 100644 index 2937c50..0000000 --- a/alphabetlearning/resources/migrations/0005_rename_feature_slot_1_resource_feature_slot_and_more.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 5.0.4 on 2024-05-22 19:26 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('resources', '0004_resource_feature_slot_1_resource_feature_slot_2_and_more'), - ] - - operations = [ - migrations.RenameField( - model_name='resource', - old_name='feature_slot_1', - new_name='feature_slot', - ), - migrations.RemoveField( - model_name='resource', - name='feature_slot_2', - ), - migrations.RemoveField( - model_name='resource', - name='feature_slot_3', - ), - ] diff --git a/alphabetlearning/resources/migrations/0006_resource_card_description_and_more.py b/alphabetlearning/resources/migrations/0006_resource_card_description_and_more.py deleted file mode 100644 index d343e76..0000000 --- a/alphabetlearning/resources/migrations/0006_resource_card_description_and_more.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 5.0.4 on 2024-05-26 15:09 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('resources', '0005_rename_feature_slot_1_resource_feature_slot_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='resource', - name='card_description', - field=models.TextField(blank=True, help_text="If you enter text here, it will be used in the 'card' description box on the home page. Max 1000 characters.", max_length=1000, null=True), - ), - migrations.AlterField( - model_name='resource', - name='feature_slot', - field=models.IntegerField(blank=True, choices=[(1, 1), (2, 2), (3, 3)], null=True, unique=True), - ), - ] diff --git a/alphabetlearning/resources/migrations/0007_alter_resource_feature_slot.py b/alphabetlearning/resources/migrations/0007_alter_resource_feature_slot.py deleted file mode 100644 index c5c17c7..0000000 --- a/alphabetlearning/resources/migrations/0007_alter_resource_feature_slot.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.4 on 2024-05-26 15:23 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('resources', '0006_resource_card_description_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='resource', - name='feature_slot', - field=models.IntegerField(blank=True, choices=[(0, 0), (1, 1), (2, 2), (3, 3)], default=0, null=True, unique=True), - ), - ] diff --git a/alphabetlearning/resources/migrations/0008_alter_resource_card_description.py b/alphabetlearning/resources/migrations/0008_alter_resource_card_description.py deleted file mode 100644 index 18e5739..0000000 --- a/alphabetlearning/resources/migrations/0008_alter_resource_card_description.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.4 on 2024-05-26 15:42 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('resources', '0007_alter_resource_feature_slot'), - ] - - operations = [ - migrations.AlterField( - model_name='resource', - name='card_description', - field=models.TextField(blank=True, default='', help_text="If you enter text here, it will be used in the 'card' description box on the home page. Max 1000 characters.", max_length=1000), - ), - ] diff --git a/alphabetlearning/resources/migrations/0009_alter_resource_feature_slot.py b/alphabetlearning/resources/migrations/0009_alter_resource_feature_slot.py deleted file mode 100644 index ca082d4..0000000 --- a/alphabetlearning/resources/migrations/0009_alter_resource_feature_slot.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.4 on 2024-05-26 18:17 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('resources', '0008_alter_resource_card_description'), - ] - - operations = [ - migrations.AlterField( - model_name='resource', - name='feature_slot', - field=models.IntegerField(blank=True, choices=[(1, 1), (2, 2), (3, 3)], default=0, null=True, unique=True), - ), - ] diff --git a/alphabetlearning/resources/migrations/0010_alter_resource_age_range.py b/alphabetlearning/resources/migrations/0010_alter_resource_age_range.py deleted file mode 100644 index 49c7a2c..0000000 --- a/alphabetlearning/resources/migrations/0010_alter_resource_age_range.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.4 on 2024-07-11 14:47 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('resources', '0009_alter_resource_feature_slot'), - ] - - operations = [ - migrations.AlterField( - model_name='resource', - name='age_range', - field=models.CharField(choices=[('Preschool (3-4yrs)', 'Preschool (3-4yrs)'), ('Nursery (2-5yrs)', 'Nursery (2-5yrs)'), ('Reception (4-5yrs)', 'Reception (4-5yrs)'), ('Year 1 (5-6yrs)', 'Year 1 (5-6yrs)'), ('Year 2 (6-7yrs)', 'Year 2 (6-7yrs)'), ('Early Years (0-5yrs)', 'Early Years (0-5yrs)'), ('Keystage 1 (5-7yrs)', 'Keystage 1 (5-7yrs)'), ('Keystage 2 (7-11yrs)', 'Keystage 2 (7-11yrs)'), ('Age not applicable', 'Age not applicable')], default='5-7', max_length=20), - ), - ] diff --git a/alphabetlearning/resources/migrations/0011_alter_resource_curriculum.py b/alphabetlearning/resources/migrations/0011_alter_resource_curriculum.py deleted file mode 100644 index 5e1b193..0000000 --- a/alphabetlearning/resources/migrations/0011_alter_resource_curriculum.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.4 on 2024-07-11 14:50 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('resources', '0010_alter_resource_age_range'), - ] - - operations = [ - migrations.AlterField( - model_name='resource', - name='curriculum', - field=models.CharField(blank=True, choices=[('No curriculum', 'No curriculum'), ('English', 'English'), ('Scottish', 'Scottish')], default='English', max_length=20, null=True), - ), - ] diff --git a/alphabetlearning/resources/migrations/0012_resourcecategory_colour_css_class.py b/alphabetlearning/resources/migrations/0012_resourcecategory_colour_css_class.py deleted file mode 100644 index b48ba61..0000000 --- a/alphabetlearning/resources/migrations/0012_resourcecategory_colour_css_class.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.4 on 2024-07-11 15:47 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('resources', '0011_alter_resource_curriculum'), - ] - - operations = [ - migrations.AddField( - model_name='resourcecategory', - name='colour_css_class', - field=models.CharField(blank=True, max_length=56, null=True), - ), - ] diff --git a/alphabetlearning/resources/migrations/0013_resourcecategory_badge_foreground_colour.py b/alphabetlearning/resources/migrations/0013_resourcecategory_badge_foreground_colour.py deleted file mode 100644 index 7644a5c..0000000 --- a/alphabetlearning/resources/migrations/0013_resourcecategory_badge_foreground_colour.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.4 on 2024-07-28 15:12 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("resources", "0012_resourcecategory_colour_css_class"), - ] - - operations = [ - migrations.AddField( - model_name="resourcecategory", - name="badge_foreground_colour", - field=models.CharField(blank=True, max_length=56, null=True), - ), - ] diff --git a/alphabetlearning/resources/migrations/0014_remove_resource_additional_resource_category_and_more.py b/alphabetlearning/resources/migrations/0014_remove_resource_additional_resource_category_and_more.py deleted file mode 100644 index 7573bf2..0000000 --- a/alphabetlearning/resources/migrations/0014_remove_resource_additional_resource_category_and_more.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by Django 5.0.4 on 2024-07-29 14:52 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("resources", "0013_resourcecategory_badge_foreground_colour"), - ] - - operations = [ - migrations.RemoveField( - model_name="resource", - name="additional_resource_category", - ), - migrations.AddField( - model_name="resource", - name="additional_resource_category", - field=models.ManyToManyField( - blank=True, - null=True, - related_name="additional_resource_category", - to="resources.resourcecategory", - ), - ), - ] diff --git a/alphabetlearning/resources/migrations/0015_resourcesubcategory.py b/alphabetlearning/resources/migrations/0015_resourcesubcategory.py deleted file mode 100644 index 3eaada4..0000000 --- a/alphabetlearning/resources/migrations/0015_resourcesubcategory.py +++ /dev/null @@ -1,30 +0,0 @@ -# Generated by Django 5.0.4 on 2024-07-29 14:55 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("resources", "0014_remove_resource_additional_resource_category_and_more"), - ] - - operations = [ - migrations.CreateModel( - name="ResourceSubcategory", - fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("name", models.CharField(max_length=255)), - ("created_at", models.DateTimeField(auto_now_add=True)), - ("updated_at", models.DateTimeField(auto_now=True)), - ], - ), - ] diff --git a/alphabetlearning/resources/migrations/0016_alter_resourcesubcategory_options_and_more.py b/alphabetlearning/resources/migrations/0016_alter_resourcesubcategory_options_and_more.py deleted file mode 100644 index 77a3f27..0000000 --- a/alphabetlearning/resources/migrations/0016_alter_resourcesubcategory_options_and_more.py +++ /dev/null @@ -1,31 +0,0 @@ -# Generated by Django 5.0.4 on 2024-07-29 15:36 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("resources", "0015_resourcesubcategory"), - ] - - operations = [ - migrations.AlterModelOptions( - name="resourcesubcategory", - options={"verbose_name_plural": "Resource Subcategories"}, - ), - migrations.AlterModelOptions( - name="resourcetype", - options={"verbose_name_plural": "Resource Types"}, - ), - migrations.AlterField( - model_name="resource", - name="additional_resource_category", - field=models.ManyToManyField( - blank=True, - null=True, - related_name="additional_resource_category", - to="resources.resourcesubcategory", - ), - ), - ] diff --git a/alphabetlearning/resources/migrations/0017_rename_additional_resource_category_resource_subcategories.py b/alphabetlearning/resources/migrations/0017_rename_additional_resource_category_resource_subcategories.py deleted file mode 100644 index bc4d1e4..0000000 --- a/alphabetlearning/resources/migrations/0017_rename_additional_resource_category_resource_subcategories.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.4 on 2024-08-01 14:29 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ("resources", "0016_alter_resourcesubcategory_options_and_more"), - ] - - operations = [ - migrations.RenameField( - model_name="resource", - old_name="additional_resource_category", - new_name="subcategories", - ), - ] diff --git a/alphabetlearning/resources/migrations/0018_alter_resource_subcategories.py b/alphabetlearning/resources/migrations/0018_alter_resource_subcategories.py deleted file mode 100644 index c981512..0000000 --- a/alphabetlearning/resources/migrations/0018_alter_resource_subcategories.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 5.0.4 on 2024-08-01 15:08 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ( - "resources", - "0017_rename_additional_resource_category_resource_subcategories", - ), - ] - - operations = [ - migrations.AlterField( - model_name="resource", - name="subcategories", - field=models.ManyToManyField( - blank=True, - related_name="additional_resource_category", - to="resources.resourcesubcategory", - ), - ), - ] diff --git a/alphabetlearning/resources/migrations/0019_alter_pdfpagesnapshot_options_and_more.py b/alphabetlearning/resources/migrations/0019_alter_pdfpagesnapshot_options_and_more.py deleted file mode 100644 index 511d747..0000000 --- a/alphabetlearning/resources/migrations/0019_alter_pdfpagesnapshot_options_and_more.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 5.0.4 on 2024-09-03 19:21 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("resources", "0018_alter_resource_subcategories"), - ] - - operations = [ - migrations.AlterModelOptions( - name="pdfpagesnapshot", - options={"verbose_name_plural": "PDF Page Snapshots"}, - ), - migrations.AlterModelOptions( - name="pdfresource", - options={"verbose_name_plural": "PDF Resources"}, - ), - migrations.AddField( - model_name="resource", - name="price", - field=models.DecimalField(decimal_places=2, default=0.0, max_digits=6), - ), - ] diff --git a/alphabetlearning/resources/migrations/0020_remove_resource_price_resource_stripe_product_id.py b/alphabetlearning/resources/migrations/0020_remove_resource_price_resource_stripe_product_id.py deleted file mode 100644 index 088556b..0000000 --- a/alphabetlearning/resources/migrations/0020_remove_resource_price_resource_stripe_product_id.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 5.0.4 on 2024-10-19 15:11 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('resources', '0019_alter_pdfpagesnapshot_options_and_more'), - ] - - operations = [ - migrations.RemoveField( - model_name='resource', - name='price', - ), - migrations.AddField( - model_name='resource', - name='stripe_product_id', - field=models.CharField(default='baws', max_length=100), - preserve_default=False, - ), - ] diff --git a/alphabetlearning/resources/models.py b/alphabetlearning/resources/models.py index 6881483..3f4ee8c 100644 --- a/alphabetlearning/resources/models.py +++ b/alphabetlearning/resources/models.py @@ -39,11 +39,11 @@ class Resource(models.Model): name = models.CharField(max_length=255, null=False) stripe_product_id = models.CharField(max_length=100) # price = models.DecimalField( - # max_digits=6, - # decimal_places=2, - # default=0.00, - # null=False, - # blank=False, + # max_digits=6, + # decimal_places=2, + # default=0.00, + # null=False, + # blank=False, # ) thumbnail_filenames = models.JSONField( null=False, diff --git a/alphabetlearning/resources/tests/test_forms.py b/alphabetlearning/resources/tests/test_forms.py index aebc110..465dc58 100644 --- a/alphabetlearning/resources/tests/test_forms.py +++ b/alphabetlearning/resources/tests/test_forms.py @@ -1,14 +1,12 @@ import pytest +from alphabetlearning.resources.factories import ResourceModelFactory +from alphabetlearning.resources.forms import ResourceCreateForm +from alphabetlearning.resources.models import ResourceCategory, ResourceType from django.core.files.uploadedfile import SimpleUploadedFile from django.db import IntegrityError from django.test import TestCase from django.utils.datastructures import MultiValueDict -from alphabetlearning.resources.factories import ResourceModelFactory -from alphabetlearning.resources.forms import ResourceCreateForm -from alphabetlearning.resources.models import ResourceCategory -from alphabetlearning.resources.models import ResourceType - class ResourceCreateFormTest(TestCase): def setUp(self): @@ -55,7 +53,7 @@ class ResourceCreateFormTest(TestCase): @pytest.mark.django_db() def test_featured_slots_must_be_unique(self): - r1 = ResourceModelFactory(feature_slot=1) + _ = ResourceModelFactory(feature_slot=1) with pytest.raises(IntegrityError): ResourceModelFactory(feature_slot=1) diff --git a/alphabetlearning/resources/views.py b/alphabetlearning/resources/views.py index 8b0f8c5..508c187 100644 --- a/alphabetlearning/resources/views.py +++ b/alphabetlearning/resources/views.py @@ -9,26 +9,16 @@ from django.conf import settings from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.paginator import Paginator -from django.db import IntegrityError -from django.db import transaction -from django.shortcuts import get_object_or_404 -from django.shortcuts import redirect -from django.shortcuts import render +from django.db import IntegrityError, transaction +from django.shortcuts import get_object_or_404, redirect, render from . import services -from .forms import ResourceCreateForm -from .forms import ResourceUpdateMetadataForm -from .forms import ResourceUpdatePDFsForm -from .forms import ResourceUpdateThumbnailsForm -from .models import PDFPageSnapshot -from .models import PDFResource -from .models import Resource -from .models import ResourceCategory -from .models import ResourceSubcategory -from .s3 import get_presigned_obj_url -from .s3 import upload_files_to_s3 -from .s3 import upload_snapshotted_pages_to_s3 -from .s3 import upload_to_s3 +from .forms import (ResourceCreateForm, ResourceUpdateMetadataForm, + ResourceUpdatePDFsForm, ResourceUpdateThumbnailsForm) +from .models import (PDFPageSnapshot, PDFResource, Resource, ResourceCategory, + ResourceSubcategory) +from .s3 import (get_presigned_obj_url, upload_files_to_s3, + upload_snapshotted_pages_to_s3, upload_to_s3) logger = logging.getLogger(__name__) diff --git a/alphabetlearning/templates/base.html b/alphabetlearning/templates/base.html index ecab232..2e28333 100644 --- a/alphabetlearning/templates/base.html +++ b/alphabetlearning/templates/base.html @@ -96,12 +96,12 @@ {% if request.user.is_authenticated %} <li class="nav-item"> <a class="nav-link text-dark fw-bold" - href="{% url "payments:cart_detail" %}">Your Basket</a> + href="{% url "payments:cart_detail" %}">Shopping Basket</a> </li> {% else %} <li class="nav-item"> <p class="nav-link text-gray fw-bold"> - Your Basket + Shopping Basket </p> </li> {% endif %} diff --git a/alphabetlearning/users/migrations/0001_initial.py b/alphabetlearning/users/migrations/0001_initial.py index 20b1233..e5caa0b 100644 --- a/alphabetlearning/users/migrations/0001_initial.py +++ b/alphabetlearning/users/migrations/0001_initial.py @@ -1,118 +1,41 @@ -import django.contrib.auth.models -import django.contrib.auth.validators -import django.utils.timezone -from django.db import migrations -from django.db import models +# Generated by Django 5.1.4 on 2024-12-31 15:26 -import alphabetlearning.users.models +import alphabetlearning.users.managers +import django.utils.timezone +from django.db import migrations, models class Migration(migrations.Migration): + initial = True dependencies = [ - ("auth", "0012_alter_user_first_name_max_length"), + ('auth', '0012_alter_user_first_name_max_length'), ] operations = [ migrations.CreateModel( - name="User", + name='User', fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("password", models.CharField(max_length=128, verbose_name="password")), - ( - "last_login", - models.DateTimeField( - blank=True, - null=True, - verbose_name="last login", - ), - ), - ( - "is_superuser", - models.BooleanField( - default=False, - help_text="Designates that this user has all permissions without explicitly assigning them.", - verbose_name="superuser status", - ), - ), - ( - "email", - models.EmailField( - unique=True, - max_length=254, - verbose_name="email address", - ), - ), - ( - "is_staff", - models.BooleanField( - default=False, - help_text="Designates whether the user can log into this admin site.", - verbose_name="staff status", - ), - ), - ( - "is_active", - models.BooleanField( - default=True, - help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.", - verbose_name="active", - ), - ), - ( - "date_joined", - models.DateTimeField( - default=django.utils.timezone.now, - verbose_name="date joined", - ), - ), - ( - "name", - models.CharField( - blank=True, - max_length=255, - verbose_name="Name of User", - ), - ), - ( - "groups", - models.ManyToManyField( - blank=True, - help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.", - related_name="user_set", - related_query_name="user", - to="auth.Group", - verbose_name="groups", - ), - ), - ( - "user_permissions", - models.ManyToManyField( - blank=True, - help_text="Specific permissions for this user.", - related_name="user_set", - related_query_name="user", - to="auth.Permission", - verbose_name="user permissions", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), + ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), + ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), + ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), + ('name', models.CharField(blank=True, max_length=255, verbose_name='Name of User')), + ('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')), + ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')), + ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')), ], options={ - "verbose_name": "user", - "verbose_name_plural": "users", - "abstract": False, + 'verbose_name': 'user', + 'verbose_name_plural': 'users', + 'abstract': False, }, managers=[ - ("objects", alphabetlearning.users.models.UserManager()), + ('objects', alphabetlearning.users.managers.UserManager()), ], ), ] diff --git a/alphabetlearning/users/tasks.py b/alphabetlearning/users/tasks.py deleted file mode 100644 index ca51cd7..0000000 --- a/alphabetlearning/users/tasks.py +++ /dev/null @@ -1,9 +0,0 @@ -from celery import shared_task - -from .models import User - - -@shared_task() -def get_users_count(): - """A pointless Celery task to demonstrate usage.""" - return User.objects.count() diff --git a/alphabetlearning/users/tests/test_tasks.py b/alphabetlearning/users/tests/test_tasks.py deleted file mode 100644 index 92f0e8a..0000000 --- a/alphabetlearning/users/tests/test_tasks.py +++ /dev/null @@ -1,17 +0,0 @@ -import pytest -from celery.result import EagerResult - -from alphabetlearning.users.tasks import get_users_count -from alphabetlearning.users.tests.factories import UserFactory - -pytestmark = pytest.mark.django_db - - -def test_user_count(settings): - """A basic test to execute the get_users_count Celery task.""" - batch_size = 3 - UserFactory.create_batch(batch_size) - settings.CELERY_TASK_ALWAYS_EAGER = True - task_result = get_users_count.delay() - assert isinstance(task_result, EagerResult) - assert task_result.result == batch_size diff --git a/compose/local/django/Dockerfile b/compose/local/django/Dockerfile deleted file mode 100644 index 553971b..0000000 --- a/compose/local/django/Dockerfile +++ /dev/null @@ -1,91 +0,0 @@ -# define an alias for the specific python version used in this file. -FROM docker.io/python:3.12.3-slim-bookworm as python - -# Python build stage -FROM python as python-build-stage - -ARG BUILD_ENVIRONMENT=local - -# Install apt packages -RUN apt-get update && apt-get install --no-install-recommends -y \ - # dependencies for building Python packages - build-essential \ - # psycopg dependencies - libpq-dev - -# Requirements are installed here to ensure they will be cached. -COPY ./requirements . - -# Create Python Dependency and Sub-Dependency Wheels. -RUN pip wheel --wheel-dir /usr/src/app/wheels \ - -r ${BUILD_ENVIRONMENT}.txt - - -# Python 'run' stage -FROM python as python-run-stage - -ARG BUILD_ENVIRONMENT=local -ARG APP_HOME=/app - -ENV PYTHONUNBUFFERED 1 -ENV PYTHONDONTWRITEBYTECODE 1 -ENV BUILD_ENV ${BUILD_ENVIRONMENT} - -WORKDIR ${APP_HOME} - - -# devcontainer dependencies and utils -RUN apt-get update && apt-get install --no-install-recommends -y \ - sudo git bash-completion nano ssh - -# Create devcontainer user and add it to sudoers -RUN groupadd --gid 1000 dev-user \ - && useradd --uid 1000 --gid dev-user --shell /bin/bash --create-home dev-user \ - && echo dev-user ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dev-user \ - && chmod 0440 /etc/sudoers.d/dev-user - - -# Install required system dependencies -RUN apt-get update && apt-get install --no-install-recommends -y \ - libmagic1 \ - # psycopg dependencies - libpq-dev \ - # Translations dependencies - gettext \ - # cleaning up unused files - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* - -# All absolute dir copies ignore workdir instruction. All relative dir copies are wrt to the workdir instruction -# copy python dependency wheels from python-build-stage -COPY --from=python-build-stage /usr/src/app/wheels /wheels/ - -# use wheels to install python dependencies -RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \ - && rm -rf /wheels/ - -COPY ./compose/production/django/entrypoint /entrypoint -RUN sed -i 's/\r$//g' /entrypoint -RUN chmod +x /entrypoint - -COPY ./compose/local/django/start /start -RUN sed -i 's/\r$//g' /start -RUN chmod +x /start - -COPY ./compose/local/django/celery/worker/start /start-celeryworker -RUN sed -i 's/\r$//g' /start-celeryworker -RUN chmod +x /start-celeryworker - -COPY ./compose/local/django/celery/beat/start /start-celerybeat -RUN sed -i 's/\r$//g' /start-celerybeat -RUN chmod +x /start-celerybeat - -COPY ./compose/local/django/celery/flower/start /start-flower -RUN sed -i 's/\r$//g' /start-flower -RUN chmod +x /start-flower - - -# copy application code to WORKDIR -COPY . ${APP_HOME} - -ENTRYPOINT ["/entrypoint"] diff --git a/compose/local/django/celery/beat/start b/compose/local/django/celery/beat/start deleted file mode 100644 index 8adc489..0000000 --- a/compose/local/django/celery/beat/start +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset - - -rm -f './celerybeat.pid' -exec watchfiles --filter python celery.__main__.main --args '-A config.celery_app beat -l INFO' diff --git a/compose/local/django/celery/flower/start b/compose/local/django/celery/flower/start deleted file mode 100644 index b4783d2..0000000 --- a/compose/local/django/celery/flower/start +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset - -exec watchfiles --filter python celery.__main__.main \ - --args \ - "-A config.celery_app -b \"${CELERY_BROKER_URL}\" flower --basic_auth=\"${CELERY_FLOWER_USER}:${CELERY_FLOWER_PASSWORD}\"" diff --git a/compose/local/django/celery/worker/start b/compose/local/django/celery/worker/start deleted file mode 100644 index 183a801..0000000 --- a/compose/local/django/celery/worker/start +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset - - -exec watchfiles --filter python celery.__main__.main --args '-A config.celery_app worker -l INFO' diff --git a/compose/local/django/start b/compose/local/django/start deleted file mode 100644 index ba96db4..0000000 --- a/compose/local/django/start +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o pipefail -set -o nounset - - -python manage.py migrate -exec python manage.py runserver_plus 0.0.0.0:8000 diff --git a/compose/local/docs/Dockerfile b/compose/local/docs/Dockerfile deleted file mode 100644 index 3556504..0000000 --- a/compose/local/docs/Dockerfile +++ /dev/null @@ -1,62 +0,0 @@ -# define an alias for the specific python version used in this file. -FROM docker.io/python:3.12.3-slim-bookworm as python - - -# Python build stage -FROM python as python-build-stage - -ENV PYTHONDONTWRITEBYTECODE 1 - -RUN apt-get update && apt-get install --no-install-recommends -y \ - # dependencies for building Python packages - build-essential \ - # psycopg dependencies - libpq-dev \ - # cleaning up unused files - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* - -# Requirements are installed here to ensure they will be cached. -COPY ./requirements /requirements - -# create python dependency wheels -RUN pip wheel --no-cache-dir --wheel-dir /usr/src/app/wheels \ - -r /requirements/local.txt -r /requirements/production.txt \ - && rm -rf /requirements - - -# Python 'run' stage -FROM python as python-run-stage - -ARG BUILD_ENVIRONMENT -ENV PYTHONUNBUFFERED 1 -ENV PYTHONDONTWRITEBYTECODE 1 - -RUN apt-get update && apt-get install --no-install-recommends -y \ - # To run the Makefile - make \ - # psycopg dependencies - libpq-dev \ - # Translations dependencies - gettext \ - # Uncomment below lines to enable Sphinx output to latex and pdf - # texlive-latex-recommended \ - # texlive-fonts-recommended \ - # texlive-latex-extra \ - # latexmk \ - # cleaning up unused files - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* - -# copy python dependency wheels from python-build-stage -COPY --from=python-build-stage /usr/src/app/wheels /wheels - -# use wheels to install python dependencies -RUN pip install --no-cache /wheels/* \ - && rm -rf /wheels - -COPY ./compose/local/docs/start /start-docs -RUN sed -i 's/\r$//g' /start-docs -RUN chmod +x /start-docs - -WORKDIR /docs diff --git a/compose/local/docs/start b/compose/local/docs/start deleted file mode 100644 index 96a94f5..0000000 --- a/compose/local/docs/start +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o pipefail -set -o nounset - -exec make livehtml diff --git a/compose/production/aws/Dockerfile b/compose/production/aws/Dockerfile deleted file mode 100644 index 36eea7f..0000000 --- a/compose/production/aws/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM docker.io/garland/aws-cli-docker:1.16.140 - -COPY ./compose/production/aws/maintenance /usr/local/bin/maintenance -COPY ./compose/production/postgres/maintenance/_sourced /usr/local/bin/maintenance/_sourced - -RUN chmod +x /usr/local/bin/maintenance/* - -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/compose/production/aws/maintenance/download b/compose/production/aws/maintenance/download deleted file mode 100644 index 9561d91..0000000 --- a/compose/production/aws/maintenance/download +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -### Download a file from your Amazon S3 bucket to the postgres /backups folder -### -### Usage: -### $ docker compose -f production.yml run --rm awscli <1> - -set -o errexit -set -o pipefail -set -o nounset - -working_dir="$(dirname ${0})" -source "${working_dir}/_sourced/constants.sh" -source "${working_dir}/_sourced/messages.sh" - -export AWS_ACCESS_KEY_ID="${DJANGO_AWS_ACCESS_KEY_ID}" -export AWS_SECRET_ACCESS_KEY="${DJANGO_AWS_SECRET_ACCESS_KEY}" -export AWS_STORAGE_BUCKET_NAME="${DJANGO_AWS_STORAGE_BUCKET_NAME}" - - -aws s3 cp s3://${AWS_STORAGE_BUCKET_NAME}${BACKUP_DIR_PATH}/${1} ${BACKUP_DIR_PATH}/${1} - -message_success "Finished downloading ${1}." diff --git a/compose/production/aws/maintenance/upload b/compose/production/aws/maintenance/upload deleted file mode 100644 index 73c1b9b..0000000 --- a/compose/production/aws/maintenance/upload +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -### Upload the /backups folder to Amazon S3 -### -### Usage: -### $ docker compose -f production.yml run --rm awscli upload - -set -o errexit -set -o pipefail -set -o nounset - -working_dir="$(dirname ${0})" -source "${working_dir}/_sourced/constants.sh" -source "${working_dir}/_sourced/messages.sh" - -export AWS_ACCESS_KEY_ID="${DJANGO_AWS_ACCESS_KEY_ID}" -export AWS_SECRET_ACCESS_KEY="${DJANGO_AWS_SECRET_ACCESS_KEY}" -export AWS_STORAGE_BUCKET_NAME="${DJANGO_AWS_STORAGE_BUCKET_NAME}" - - -message_info "Upload the backups directory to S3 bucket {$AWS_STORAGE_BUCKET_NAME}" - -aws s3 cp ${BACKUP_DIR_PATH} s3://${AWS_STORAGE_BUCKET_NAME}${BACKUP_DIR_PATH} --recursive - -message_info "Cleaning the directory ${BACKUP_DIR_PATH}" - -rm -rf ${BACKUP_DIR_PATH}/* - -message_success "Finished uploading and cleaning." diff --git a/compose/production/django/Dockerfile b/compose/production/django/Dockerfile deleted file mode 100644 index e81a03c..0000000 --- a/compose/production/django/Dockerfile +++ /dev/null @@ -1,91 +0,0 @@ - -# define an alias for the specific python version used in this file. -FROM docker.io/python:3.12.3-slim-bookworm as python - -# Python build stage -FROM python as python-build-stage - -ARG BUILD_ENVIRONMENT=production - -# Install apt packages -RUN apt-get update && apt-get install --no-install-recommends -y \ - # dependencies for building Python packages - build-essential \ - # psycopg dependencies - libpq-dev - -# Requirements are installed here to ensure they will be cached. -COPY ./requirements . - -# Create Python Dependency and Sub-Dependency Wheels. -RUN pip wheel --wheel-dir /usr/src/app/wheels \ - -r ${BUILD_ENVIRONMENT}.txt - - -# Python 'run' stage -FROM python as python-run-stage - -ARG BUILD_ENVIRONMENT=production -ARG APP_HOME=/app - -ENV PYTHONUNBUFFERED 1 -ENV PYTHONDONTWRITEBYTECODE 1 -ENV BUILD_ENV ${BUILD_ENVIRONMENT} - -WORKDIR ${APP_HOME} - -RUN addgroup --system django \ - && adduser --system --ingroup django django - - -# Install required system dependencies -RUN apt-get update && apt-get install --no-install-recommends -y \ - libmagic1 \ - # psycopg dependencies - libpq-dev \ - # Translations dependencies - gettext \ - # cleaning up unused files - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* - -# All absolute dir copies ignore workdir instruction. All relative dir copies are wrt to the workdir instruction -# copy python dependency wheels from python-build-stage -COPY --from=python-build-stage /usr/src/app/wheels /wheels/ - -# use wheels to install python dependencies -RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \ - && rm -rf /wheels/ - -# COPY --chown=django:django ./compose/production/django/entrypoint /entrypoint -# RUN sed -i 's/\r$//g' /entrypoint -# RUN chmod +x /entrypoint - -# COPY --chown=django:django ./compose/production/django/start /start -# RUN sed -i 's/\r$//g' /start -# RUN chmod +x /start -# COPY --chown=django:django ./compose/production/django/celery/worker/start /start-celeryworker -# RUN sed -i 's/\r$//g' /start-celeryworker -# RUN chmod +x /start-celeryworker - - -# COPY --chown=django:django ./compose/production/django/celery/beat/start /start-celerybeat -# RUN sed -i 's/\r$//g' /start-celerybeat -# RUN chmod +x /start-celerybeat - - -# COPY --chown=django:django ./compose/production/django/celery/flower/start /start-flower -# RUN sed -i 's/\r$//g' /start-flower -# RUN chmod +x /start-flower - - -# copy application code to WORKDIR -COPY --chown=django:django . ${APP_HOME} - -# make django owner of the WORKDIR directory as well. -RUN chown -R django:django ${APP_HOME} - -USER django - -RUN chmod +x docker-entrypoint.sh -ENTRYPOINT ["/app/docker-entrypoint.sh"] diff --git a/compose/production/django/celery/beat/start b/compose/production/django/celery/beat/start deleted file mode 100644 index 42ddca9..0000000 --- a/compose/production/django/celery/beat/start +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o pipefail -set -o nounset - - -exec celery -A config.celery_app beat -l INFO diff --git a/compose/production/django/celery/flower/start b/compose/production/django/celery/flower/start deleted file mode 100644 index 4180d67..0000000 --- a/compose/production/django/celery/flower/start +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset - - -exec celery \ - -A config.celery_app \ - -b "${CELERY_BROKER_URL}" \ - flower \ - --basic_auth="${CELERY_FLOWER_USER}:${CELERY_FLOWER_PASSWORD}" diff --git a/compose/production/django/celery/worker/start b/compose/production/django/celery/worker/start deleted file mode 100644 index af0c8f7..0000000 --- a/compose/production/django/celery/worker/start +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o pipefail -set -o nounset - - -exec celery -A config.celery_app worker -l INFO diff --git a/compose/production/django/entrypoint b/compose/production/django/entrypoint deleted file mode 100644 index 249d8d9..0000000 --- a/compose/production/django/entrypoint +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o pipefail -set -o nounset - - - -# N.B. If only .env files supported variable expansion... -export CELERY_BROKER_URL="${REDIS_URL}" - - -if [ -z "${POSTGRES_USER}" ]; then - base_postgres_image_default_user='postgres' - export POSTGRES_USER="${base_postgres_image_default_user}" -fi -export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" - -python << END -import sys -import time - -import psycopg - -suggest_unrecoverable_after = 30 -start = time.time() - -while True: - try: - psycopg.connect( - dbname="${POSTGRES_DB}", - user="${POSTGRES_USER}", - password="${POSTGRES_PASSWORD}", - host="${POSTGRES_HOST}", - port="${POSTGRES_PORT}", - ) - break - except psycopg.OperationalError as error: - sys.stderr.write("Waiting for PostgreSQL to become available...\n") - - if time.time() - start > suggest_unrecoverable_after: - sys.stderr.write(" This is taking longer than expected. The following exception may be indicative of an unrecoverable error: '{}'\n".format(error)) - - time.sleep(1) -END - ->&2 echo 'PostgreSQL is available' - -exec "$@" diff --git a/compose/production/django/start b/compose/production/django/start deleted file mode 100644 index 97216fa..0000000 --- a/compose/production/django/start +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o pipefail -set -o nounset - - -python /app/manage.py collectstatic --noinput - -exec /usr/local/bin/gunicorn config.wsgi --bind 0.0.0.0:5000 --chdir=/app diff --git a/compose/production/nginx/Dockerfile b/compose/production/nginx/Dockerfile deleted file mode 100644 index ec2ad35..0000000 --- a/compose/production/nginx/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM docker.io/nginx:1.17.8-alpine -COPY ./compose/production/nginx/default.conf /etc/nginx/conf.d/default.conf diff --git a/compose/production/nginx/default.conf b/compose/production/nginx/default.conf deleted file mode 100644 index 562dba8..0000000 --- a/compose/production/nginx/default.conf +++ /dev/null @@ -1,7 +0,0 @@ -server { - listen 80; - server_name localhost; - location /media/ { - alias /usr/share/nginx/media/; - } -} diff --git a/compose/production/postgres/Dockerfile b/compose/production/postgres/Dockerfile deleted file mode 100644 index 176a5f1..0000000 --- a/compose/production/postgres/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM docker.io/postgres:16 - -COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/compose/production/postgres/maintenance/_sourced/constants.sh b/compose/production/postgres/maintenance/_sourced/constants.sh deleted file mode 100644 index 6ca4f0c..0000000 --- a/compose/production/postgres/maintenance/_sourced/constants.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - - -BACKUP_DIR_PATH='/backups' -BACKUP_FILE_PREFIX='backup' diff --git a/compose/production/postgres/maintenance/_sourced/countdown.sh b/compose/production/postgres/maintenance/_sourced/countdown.sh deleted file mode 100644 index e6cbfb6..0000000 --- a/compose/production/postgres/maintenance/_sourced/countdown.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - - -countdown() { - declare desc="A simple countdown. Source: https://superuser.com/a/611582" - local seconds="${1}" - local d=$(($(date +%s) + "${seconds}")) - while [ "$d" -ge `date +%s` ]; do - echo -ne "$(date -u --date @$(($d - `date +%s`)) +%H:%M:%S)\r"; - sleep 0.1 - done -} diff --git a/compose/production/postgres/maintenance/_sourced/messages.sh b/compose/production/postgres/maintenance/_sourced/messages.sh deleted file mode 100644 index f6be756..0000000 --- a/compose/production/postgres/maintenance/_sourced/messages.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - - -message_newline() { - echo -} - -message_debug() -{ - echo -e "DEBUG: ${@}" -} - -message_welcome() -{ - echo -e "\e[1m${@}\e[0m" -} - -message_warning() -{ - echo -e "\e[33mWARNING\e[0m: ${@}" -} - -message_error() -{ - echo -e "\e[31mERROR\e[0m: ${@}" -} - -message_info() -{ - echo -e "\e[37mINFO\e[0m: ${@}" -} - -message_suggestion() -{ - echo -e "\e[33mSUGGESTION\e[0m: ${@}" -} - -message_success() -{ - echo -e "\e[32mSUCCESS\e[0m: ${@}" -} diff --git a/compose/production/postgres/maintenance/_sourced/yes_no.sh b/compose/production/postgres/maintenance/_sourced/yes_no.sh deleted file mode 100644 index fd9cae1..0000000 --- a/compose/production/postgres/maintenance/_sourced/yes_no.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - - -yes_no() { - declare desc="Prompt for confirmation. \$\"\{1\}\": confirmation message." - local arg1="${1}" - - local response= - read -r -p "${arg1} (y/[n])? " response - if [[ "${response}" =~ ^[Yy]$ ]] - then - exit 0 - else - exit 1 - fi -} diff --git a/compose/production/postgres/maintenance/backup b/compose/production/postgres/maintenance/backup deleted file mode 100644 index f72304c..0000000 --- a/compose/production/postgres/maintenance/backup +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - - -### Create a database backup. -### -### Usage: -### $ docker compose -f <environment>.yml (exec |run --rm) postgres backup - - -set -o errexit -set -o pipefail -set -o nounset - - -working_dir="$(dirname ${0})" -source "${working_dir}/_sourced/constants.sh" -source "${working_dir}/_sourced/messages.sh" - - -message_welcome "Backing up the '${POSTGRES_DB}' database..." - - -if [[ "${POSTGRES_USER}" == "postgres" ]]; then - message_error "Backing up as 'postgres' user is not supported. Assign 'POSTGRES_USER' env with another one and try again." - exit 1 -fi - -export PGHOST="${POSTGRES_HOST}" -export PGPORT="${POSTGRES_PORT}" -export PGUSER="${POSTGRES_USER}" -export PGPASSWORD="${POSTGRES_PASSWORD}" -export PGDATABASE="${POSTGRES_DB}" - -backup_filename="${BACKUP_FILE_PREFIX}_$(date +'%Y_%m_%dT%H_%M_%S').sql.gz" -pg_dump | gzip > "${BACKUP_DIR_PATH}/${backup_filename}" - - -message_success "'${POSTGRES_DB}' database backup '${backup_filename}' has been created and placed in '${BACKUP_DIR_PATH}'." diff --git a/compose/production/postgres/maintenance/backups b/compose/production/postgres/maintenance/backups deleted file mode 100644 index a18937d..0000000 --- a/compose/production/postgres/maintenance/backups +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - - -### View backups. -### -### Usage: -### $ docker compose -f <environment>.yml (exec |run --rm) postgres backups - - -set -o errexit -set -o pipefail -set -o nounset - - -working_dir="$(dirname ${0})" -source "${working_dir}/_sourced/constants.sh" -source "${working_dir}/_sourced/messages.sh" - - -message_welcome "These are the backups you have got:" - -ls -lht "${BACKUP_DIR_PATH}" diff --git a/compose/production/postgres/maintenance/restore b/compose/production/postgres/maintenance/restore deleted file mode 100644 index c68f17d..0000000 --- a/compose/production/postgres/maintenance/restore +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - - -### Restore database from a backup. -### -### Parameters: -### <1> filename of an existing backup. -### -### Usage: -### $ docker compose -f <environment>.yml (exec |run --rm) postgres restore <1> - - -set -o errexit -set -o pipefail -set -o nounset - - -working_dir="$(dirname ${0})" -source "${working_dir}/_sourced/constants.sh" -source "${working_dir}/_sourced/messages.sh" - - -if [[ -z ${1+x} ]]; then - message_error "Backup filename is not specified yet it is a required parameter. Make sure you provide one and try again." - exit 1 -fi -backup_filename="${BACKUP_DIR_PATH}/${1}" -if [[ ! -f "${backup_filename}" ]]; then - message_error "No backup with the specified filename found. Check out the 'backups' maintenance script output to see if there is one and try again." - exit 1 -fi - -message_welcome "Restoring the '${POSTGRES_DB}' database from the '${backup_filename}' backup..." - -if [[ "${POSTGRES_USER}" == "postgres" ]]; then - message_error "Restoring as 'postgres' user is not supported. Assign 'POSTGRES_USER' env with another one and try again." - exit 1 -fi - -export PGHOST="${POSTGRES_HOST}" -export PGPORT="${POSTGRES_PORT}" -export PGUSER="${POSTGRES_USER}" -export PGPASSWORD="${POSTGRES_PASSWORD}" -export PGDATABASE="${POSTGRES_DB}" - -message_info "Dropping the database..." -dropdb "${PGDATABASE}" - -message_info "Creating a new database..." -createdb --owner="${POSTGRES_USER}" - -message_info "Applying the backup to the new database..." -gunzip -c "${backup_filename}" | psql "${POSTGRES_DB}" - -message_success "The '${POSTGRES_DB}' database has been restored from the '${backup_filename}' backup." diff --git a/compose/production/postgres/maintenance/rmbackup b/compose/production/postgres/maintenance/rmbackup deleted file mode 100644 index fdfd20e..0000000 --- a/compose/production/postgres/maintenance/rmbackup +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -### Remove a database backup. -### -### Parameters: -### <1> filename of a backup to remove. -### -### Usage: -### $ docker-compose -f <environment>.yml (exec |run --rm) postgres rmbackup <1> - - -set -o errexit -set -o pipefail -set -o nounset - - -working_dir="$(dirname ${0})" -source "${working_dir}/_sourced/constants.sh" -source "${working_dir}/_sourced/messages.sh" - - -if [[ -z ${1+x} ]]; then - message_error "Backup filename is not specified yet it is a required parameter. Make sure you provide one and try again." - exit 1 -fi -backup_filename="${BACKUP_DIR_PATH}/${1}" -if [[ ! -f "${backup_filename}" ]]; then - message_error "No backup with the specified filename found. Check out the 'backups' maintenance script output to see if there is one and try again." - exit 1 -fi - -message_welcome "Removing the '${backup_filename}' backup file..." - -rm -r "${backup_filename}" - -message_success "The '${backup_filename}' database backup has been removed." diff --git a/compose/production/traefik/Dockerfile b/compose/production/traefik/Dockerfile deleted file mode 100644 index d54bf27..0000000 --- a/compose/production/traefik/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM docker.io/traefik:2.11.2 -RUN mkdir -p /etc/traefik/acme \ - && touch /etc/traefik/acme/acme.json \ - && chmod 600 /etc/traefik/acme/acme.json -COPY ./compose/production/traefik/traefik.yml /etc/traefik diff --git a/compose/production/traefik/traefik.yml b/compose/production/traefik/traefik.yml deleted file mode 100644 index 4c274d1..0000000 --- a/compose/production/traefik/traefik.yml +++ /dev/null @@ -1,75 +0,0 @@ -log: - level: INFO - -entryPoints: - web: - # http - address: ':80' - http: - # https://doc.traefik.io/traefik/routing/entrypoints/#entrypoint - redirections: - entryPoint: - to: web-secure - - web-secure: - # https - address: ':443' - - flower: - address: ':5555' - -certificatesResolvers: - letsencrypt: - # https://doc.traefik.io/traefik/https/acme/#lets-encrypt - acme: - email: 'y@yulqen.org' - storage: /etc/traefik/acme/acme.json - # https://doc.traefik.io/traefik/https/acme/#httpchallenge - httpChallenge: - entryPoint: web - -http: - routers: - web-secure-router: - rule: 'Host(`resources.joannalemon.com`)' - entryPoints: - - web-secure - middlewares: - - csrf - service: django - tls: - # https://doc.traefik.io/traefik/routing/routers/#certresolver - certResolver: letsencrypt - - flower-secure-router: - rule: 'Host(`resources.joannalemon.com`)' - entryPoints: - - flower - service: flower - tls: - # https://doc.traefik.io/traefik/master/routing/routers/#certresolver - certResolver: letsencrypt - - middlewares: - csrf: - # https://doc.traefik.io/traefik/master/middlewares/http/headers/#hostsproxyheaders - # https://docs.djangoproject.com/en/dev/ref/csrf/#ajax - headers: - hostsProxyHeaders: ['X-CSRFToken'] - - services: - django: - loadBalancer: - servers: - - url: http://django:5000 - - flower: - loadBalancer: - servers: - - url: http://flower:5555 - -providers: - # https://doc.traefik.io/traefik/master/providers/file/ - file: - filename: /etc/traefik/traefik.yml - watch: true diff --git a/config/__init__.py b/config/__init__.py index 10f5014..e69de29 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -1,5 +0,0 @@ -# This will make sure the app is always imported when -# Django starts so that shared_task will use this app. -from .celery_app import app as celery_app - -__all__ = ("celery_app",) diff --git a/config/celery_app.py b/config/celery_app.py deleted file mode 100644 index 7af2082..0000000 --- a/config/celery_app.py +++ /dev/null @@ -1,17 +0,0 @@ -import os - -from celery import Celery - -# set the default Django settings module for the 'celery' program. -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") - -app = Celery("alphabetlearning") - -# Using a string here means the worker doesn't have to serialize -# the configuration object to child processes. -# - namespace='CELERY' means all celery-related configuration keys -# should have a `CELERY_` prefix. -app.config_from_object("django.conf:settings", namespace="CELERY") - -# Load task modules from all registered Django app configs. -app.autodiscover_tasks() diff --git a/config/settings/base.py b/config/settings/base.py index 991605c..a218856 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -44,8 +44,30 @@ LOCALE_PATHS = [str(BASE_DIR / "locale")] # DATABASES # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#databases -DATABASES = {"default": env.db("DATABASE_URL")} -DATABASES["default"]["ATOMIC_REQUESTS"] = True +# DATABASES = {"default": env.db("DATABASE_URL")} +# DATABASES["default"]["ATOMIC_REQUESTS"] = True + +DATABASES = { + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": BASE_DIR / "db.sqlite3", + "OPTIONS": { + "init_command": ( + "PRAGMA foreign_keys=ON;" + "PRAGMA journal_mode = WAL;" + "PRAGMA synchronous = NORMAL;" + "PRAGMA busy_timeout = 5000;" + "PRAGMA temp_store = MEMORY;" + "PRAGMA mmap_size = 134217729;" + "PRAGMA journal_size_limit = 67108864;" + "PRAGMA cache_size = 2000;" + ), + "transaction_mode": "IMMEDIATE", + }, + }, +} + + # https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-DEFAULT_AUTO_FIELD DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" @@ -75,8 +97,7 @@ THIRD_PARTY_APPS = [ "allauth", "allauth.account", "allauth.mfa", - "allauth.socialaccount", - "django_celery_beat", + # "allauth.socialaccount", "django_recaptcha", ] @@ -266,41 +287,6 @@ LOGGING = { "root": {"level": "INFO", "handlers": ["console"]}, } -# Celery -# ------------------------------------------------------------------------------ -# if USE_TZ: -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-timezone -# CELERY_TIMEZONE = TIME_ZONE -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-broker_url -# CELERY_BROKER_URL = env("CELERY_BROKER_URL") -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-result_backend -# CELERY_RESULT_BACKEND = CELERY_BROKER_URL -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended -# CELERY_RESULT_EXTENDED = True -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-backend-always-retry -# # https://github.com/celery/celery/pull/6122 -# CELERY_RESULT_BACKEND_ALWAYS_RETRY = True -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-backend-max-retries -# CELERY_RESULT_BACKEND_MAX_RETRIES = 10 -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-accept_content -# CELERY_ACCEPT_CONTENT = ["json"] -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-task_serializer -# CELERY_TASK_SERIALIZER = "json" -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-result_serializer -# CELERY_RESULT_SERIALIZER = "json" -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-time-limit -# # TODO: set to whatever value is adequate in your circumstances -# CELERY_TASK_TIME_LIMIT = 5 * 60 -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-soft-time-limit -# # TODO: set to whatever value is adequate in your circumstances -# CELERY_TASK_SOFT_TIME_LIMIT = 60 -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#beat-scheduler -# CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler" -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#worker-send-task-events -# CELERY_WORKER_SEND_TASK_EVENTS = True -# # https://docs.celeryq.dev/en/stable/userguide/configuration.html#std-setting-task_send_sent_event -# CELERY_TASK_SEND_SENT_EVENT = True - # django-allauth # ------------------------------------------------------------------------------ ACCOUNT_ALLOW_REGISTRATION = env.bool("DJANGO_ACCOUNT_ALLOW_REGISTRATION", True) @@ -358,16 +344,12 @@ AWS_S3_ENDPOINT_URL = env("SPACES_ENDPOINT_URL") # Your stuff... # ------------------------------------------------------------------------------ -MAILGUN_API_KEY = env("MAILGUN_API_KEY") -MAILGUN_SENDER_DOMAIN = env("MAILGUN_SENDER_DOMAIN") -MAILGUN_API_URL = env("MAILGUN_API_URL", default="https://api.eu.mailgun.net/v3") - -CACHES = { - "default": { - "BACKEND": "django.core.cache.backends.db.DatabaseCache", - "LOCATION": "rate_limit_cache", - }, -} +# CACHES = { +# "default": { +# "BACKEND": "django.core.cache.backends.db.DatabaseCache", +# "LOCATION": "rate_limit_cache", +# }, +# } RECAPTCHA_PUBLIC_KEY = env("RECAPTCHA_PUBLIC_KEY") RECAPTCHA_PRIVATE_KEY = env("RECAPTCHA_PRIVATE_KEY") diff --git a/config/settings/local.py b/config/settings/local.py index e95cbb9..9174857 100644 --- a/config/settings/local.py +++ b/config/settings/local.py @@ -14,7 +14,7 @@ SECRET_KEY = env( default="4MZuqVXy7rToppiUhiTBxzlQH8OxPDDmu4rsTqFiyAyLF50WPBVzX5ZFBLpwJPyY", ) # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts -ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1"] # noqa: S104 +ALLOWED_HOSTS = ["*"] # noqa: S104 # CACHES # ------------------------------------------------------------------------------ @@ -73,10 +73,6 @@ if env("USE_DOCKER") == "yes": # ------------------------------------------------------------------------------ # https://django-extensions.readthedocs.io/en/latest/installation_instructions.html#configuration # INSTALLED_APPS += ["django_extensions"] -# Celery -# ------------------------------------------------------------------------------ -# https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-eager-propagates -CELERY_TASK_EAGER_PROPAGATES = True # Your stuff... # ------------------------------------------------------------------------------ diff --git a/config/settings/production.py b/config/settings/production.py index 252f882..bac2fa5 100644 --- a/config/settings/production.py +++ b/config/settings/production.py @@ -2,7 +2,6 @@ from .base import * # noqa: F403 -from .base import DATABASES from .base import env # GENERAL @@ -10,11 +9,17 @@ from .base import env # https://docs.djangoproject.com/en/dev/ref/settings/#secret-key SECRET_KEY = env("DJANGO_SECRET_KEY") # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts -ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["alphabetlearning.online"]) +# ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["alphabetlearning.online"]) +ALLOWED_HOSTS = [ + "alphabetlearning.online", + "www.alphabetlearning.online", + "staging.alphabetlearning.online", + "www.staging.alphabetlearning.online", +] # DATABASES # ------------------------------------------------------------------------------ -DATABASES["default"]["CONN_MAX_AGE"] = env.int("CONN_MAX_AGE", default=60) +# DATABASES["default"]["CONN_MAX_AGE"] = env.int("CONN_MAX_AGE", default=60) # CACHES # ------------------------------------------------------------------------------ @@ -127,21 +132,7 @@ EMAIL_USE_TLS = env.bool("EMAIL_USE_TLS", default=True) # Django Admin URL regex. ADMIN_URL = env("DJANGO_ADMIN_URL") -# Anymail -# ------------------------------------------------------------------------------ -# https://anymail.readthedocs.io/en/stable/installation/#installing-anymail -# INSTALLED_APPS += ["anymail"] -# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend -# https://anymail.readthedocs.io/en/stable/installation/#anymail-settings-reference -# https://anymail.readthedocs.io/en/stable/esps/mailgun/ -# EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend" -# ANYMAIL = { -# "MAILGUN_API_KEY": env("MAILGUN_API_KEY"), -# "MAILGUN_SENDER_DOMAIN": env("MAILGUN_DOMAIN"), -# "MAILGUN_API_URL": env("MAILGUN_API_URL", default="https://api.mailgun.net/v3"), -# } - -#EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" +# EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" # LOGGING # ------------------------------------------------------------------------------ @@ -160,7 +151,7 @@ LOGGING = { "file": { "level": "DEBUG", "class": "logging.FileHandler", - "filename": "/home/django/logfile.log", # Update this path + "filename": "/app/logfile.log", # Update this path }, }, "loggers": { @@ -233,12 +224,7 @@ LOGGING = { # Your stuff... -# My manual Mailgun stuff -MAILGUN_API_KEY = env("MAILGUN_API_KEY") -MAILGUN_SENDER_DOMAIN = env("MAILGUN_SENDER_DOMAIN") -MAILGUN_API_URL = env("MAILGUN_API_URL", default="https://api.eu.mailgun.net/v3") - USE_X_FORWARDED_HOST = True SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") RECAPTCHA_USE_SSL = True # Use HTTPS for requests -#RECAPTCHA_PROXY = {'http': 'http://127.0.0.1:5000', 'https': 'https://127.0.0.1:5000'} +# RECAPTCHA_PROXY = {'http': 'http://127.0.0.1:5000', 'https': 'https://127.0.0.1:5000'} diff --git a/cookies.txt b/cookies.txt deleted file mode 100644 index 6bef457..0000000 --- a/cookies.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Netscape HTTP Cookie File -# https://curl.se/docs/http-cookies.html -# This file was generated by libcurl! Edit at your own risk. - -#HttpOnly_127.0.0.1 FALSE / FALSE 1765141225 csrftoken ZvMDpDcXBf12tnCdJGlR0i8AcBUnh0rX diff --git a/docker-compose.yaml b/docker-compose.yaml index 6266d70..7692ef9 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,38 +1,12 @@ services: - db: - image: postgres:14 - volumes: - - postgres_data:/var/lib/postgresql/data/ - healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] - interval: 10s - timeout: 5s - retries: 5 - environment: - POSTGRES_DB: ${POSTGRES_DB} - POSTGRES_USER: ${POSTGRES_USER} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - networks: - - app-network - web: - build: . - command: gunicorn config.wsgi:application --bind 0.0.0.0:3000 - environment: - DJANGO_READ_DOT_ENV_FILE: True - volumes: - - .:/code + # image: haircode/alphabetlearning:latest + build: + context: . + network: host ports: - - "3000:3000" - depends_on: - - db - # env_file: - # - .env - networks: - - app-network - -volumes: - postgres_data: + - "8020:8020" + volumes: + - .:/app + command: uv run manage.py runserver 0.0.0.0:8020 -networks: - app-network: diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh deleted file mode 100755 index 34b6867..0000000 --- a/docker-entrypoint.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -echo "Running migrations..." -./wait-for-it.sh db:5432 --timeout=30 --strict -- echo "Postgres is up" - -cd /app -python manage.py migrate -python manage.py collectstatic --noinput -exec gunicorn --bind ':3000' --worker-tmp-dir /dev/shm --workers 3 config.wsgi:application diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 6957700..0000000 --- a/docs/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = . -BUILDDIR = ./_build -APP = /app - -.PHONY: help livehtml apidocs Makefile - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -c . - -# Build, watch and serve docs with live reload -livehtml: - sphinx-autobuild -b html --host 0.0.0.0 --port 9000 --watch $(APP) -c . $(SOURCEDIR) $(BUILDDIR)/html - -# Outputs rst files from django application code -apidocs: - sphinx-apidoc -o $(SOURCEDIR)/api $(APP) - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -c . diff --git a/docs/__init__.py b/docs/__init__.py deleted file mode 100644 index 8772c82..0000000 --- a/docs/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Included so that Django's startproject comment runs against the docs directory diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index 3dc1bc6..0000000 --- a/docs/conf.py +++ /dev/null @@ -1,64 +0,0 @@ -# ruff: noqa -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. - -import os -import sys -import django - -if os.getenv("READTHEDOCS", default=False) == "True": - sys.path.insert(0, os.path.abspath("..")) - os.environ["DJANGO_READ_DOT_ENV_FILE"] = "True" - os.environ["USE_DOCKER"] = "no" -else: - sys.path.insert(0, os.path.abspath("/app")) -os.environ["DATABASE_URL"] = "sqlite:///readthedocs.db" -os.environ["CELERY_BROKER_URL"] = os.getenv("REDIS_URL", "redis://redis:6379") -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") -django.setup() - -# -- Project information ----------------------------------------------------- - -project = "pyblackbird-cc" -copyright = """2024, Matthew Lemon""" -author = "Matthew Lemon" - - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.napoleon", -] - -# Add any paths that contain templates here, relative to this directory. -# templates_path = ["_templates"] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = "alabaster" - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -# html_static_path = ["_static"] diff --git a/docs/howto.rst b/docs/howto.rst deleted file mode 100644 index 5858a25..0000000 --- a/docs/howto.rst +++ /dev/null @@ -1,38 +0,0 @@ -How To - Project Documentation -====================================================================== - -Get Started ----------------------------------------------------------------------- - -Documentation can be written as rst files in `alphabetlearning/docs`. - - -To build and serve docs, use the commands:: - - docker compose -f local.yml up docs - - - -Changes to files in `docs/_source` will be picked up and reloaded automatically. - -`Sphinx <https://www.sphinx-doc.org/>`_ is the tool used to build documentation. - -Docstrings to Documentation ----------------------------------------------------------------------- - -The sphinx extension `apidoc <https://www.sphinx-doc.org/en/master/man/sphinx-apidoc.html>`_ is used to automatically document code using signatures and docstrings. - -Numpy or Google style docstrings will be picked up from project files and available for documentation. See the `Napoleon <https://sphinxcontrib-napoleon.readthedocs.io/en/latest/>`_ extension for details. - -For an in-use example, see the `page source <_sources/users.rst.txt>`_ for :ref:`users`. - -To compile all docstrings automatically into documentation source files, use the command: - :: - - make apidocs - - -This can be done in the docker container: - :: - - docker run --rm docs make apidocs diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index afb7889..0000000 --- a/docs/index.rst +++ /dev/null @@ -1,24 +0,0 @@ -.. pyblackbird-cc documentation master file, created by - sphinx-quickstart. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to pyblackbird-cc's documentation! -====================================================================== - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - - howto - pycharm/configuration - users - - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index 7e05187..0000000 --- a/docs/make.bat +++ /dev/null @@ -1,46 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -c . -) -set SOURCEDIR=_source -set BUILDDIR=_build -set APP=..\alphabetlearning - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.Install sphinx-autobuild for live serving. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -b %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:livehtml -sphinx-autobuild -b html --open-browser -p 9000 --watch %APP% -c . %SOURCEDIR% %BUILDDIR%/html -GOTO :EOF - -:apidocs -sphinx-apidoc -o %SOURCEDIR%/api %APP% -GOTO :EOF - -:help -%SPHINXBUILD% -b help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/docs/pycharm/configuration.rst b/docs/pycharm/configuration.rst deleted file mode 100644 index ffc7f61..0000000 --- a/docs/pycharm/configuration.rst +++ /dev/null @@ -1,70 +0,0 @@ -Docker Remote Debugging -======================= - -To connect to python remote interpreter inside docker, you have to make sure first, that Pycharm is aware of your docker. - -Go to *Settings > Build, Execution, Deployment > Docker*. If you are on linux, you can use docker directly using its socket `unix:///var/run/docker.sock`, if you are on Windows or Mac, make sure that you have docker-machine installed, then you can simply *Import credentials from Docker Machine*. - -.. image:: images/1.png - -Configure Remote Python Interpreter ------------------------------------ - -This repository comes with already prepared "Run/Debug Configurations" for docker. - -.. image:: images/2.png - -But as you can see, at the beginning there is something wrong with them. They have red X on django icon, and they cannot be used, without configuring remote python interpreter. To do that, you have to go to *Settings > Build, Execution, Deployment* first. - - -Next, you have to add new remote python interpreter, based on already tested deployment settings. Go to *Settings > Project > Project Interpreter*. Click on the cog icon, and click *Add Remote*. - -.. image:: images/3.png - -Switch to *Docker Compose* and select `local.yml` file from directory of your project, next set *Service name* to `django` - -.. image:: images/4.png - -Having that, click *OK*. Close *Settings* panel, and wait few seconds... - -.. image:: images/7.png - -After few seconds, all *Run/Debug Configurations* should be ready to use. - -.. image:: images/8.png - -**Things you can do with provided configuration**: - -* run and debug python code - -.. image:: images/f1.png - -* run and debug tests - -.. image:: images/f2.png -.. image:: images/f3.png - -* run and debug migrations or different django management commands - -.. image:: images/f4.png - -* and many others.. - -Known issues ------------- - -* Pycharm hangs on "Connecting to Debugger" - -.. image:: images/issue1.png - -This might be fault of your firewall. Take a look on this ticket - https://youtrack.jetbrains.com/issue/PY-18913 - -* Modified files in `.idea` directory - -Most of the files from `.idea/` were added to `.gitignore` with a few exceptions, which were made, to provide "ready to go" configuration. After adding remote interpreter some of these files are altered by PyCharm: - -.. image:: images/issue2.png - -In theory you can remove them from repository, but then, other people will lose a ability to initialize a project from provided configurations as you did. To get rid of this annoying state, you can run command:: - - $ git update-index --assume-unchanged alphabetlearning.iml diff --git a/docs/pycharm/images/1.png b/docs/pycharm/images/1.png Binary files differdeleted file mode 100644 index 06908a1..0000000 --- a/docs/pycharm/images/1.png +++ /dev/null diff --git a/docs/pycharm/images/2.png b/docs/pycharm/images/2.png Binary files differdeleted file mode 100644 index 1fb8cf1..0000000 --- a/docs/pycharm/images/2.png +++ /dev/null diff --git a/docs/pycharm/images/3.png b/docs/pycharm/images/3.png Binary files differdeleted file mode 100644 index 32c9335..0000000 --- a/docs/pycharm/images/3.png +++ /dev/null diff --git a/docs/pycharm/images/4.png b/docs/pycharm/images/4.png Binary files differdeleted file mode 100644 index cf07f9d..0000000 --- a/docs/pycharm/images/4.png +++ /dev/null diff --git a/docs/pycharm/images/7.png b/docs/pycharm/images/7.png Binary files differdeleted file mode 100644 index 4f8807e..0000000 --- a/docs/pycharm/images/7.png +++ /dev/null diff --git a/docs/pycharm/images/8.png b/docs/pycharm/images/8.png Binary files differdeleted file mode 100644 index 05946f2..0000000 --- a/docs/pycharm/images/8.png +++ /dev/null diff --git a/docs/pycharm/images/f1.png b/docs/pycharm/images/f1.png Binary files differdeleted file mode 100644 index 2d8c4b6..0000000 --- a/docs/pycharm/images/f1.png +++ /dev/null diff --git a/docs/pycharm/images/f2.png b/docs/pycharm/images/f2.png Binary files differdeleted file mode 100644 index b123a47..0000000 --- a/docs/pycharm/images/f2.png +++ /dev/null diff --git a/docs/pycharm/images/f3.png b/docs/pycharm/images/f3.png Binary files differdeleted file mode 100644 index 713ab54..0000000 --- a/docs/pycharm/images/f3.png +++ /dev/null diff --git a/docs/pycharm/images/f4.png b/docs/pycharm/images/f4.png Binary files differdeleted file mode 100644 index 11668ec..0000000 --- a/docs/pycharm/images/f4.png +++ /dev/null diff --git a/docs/pycharm/images/issue1.png b/docs/pycharm/images/issue1.png Binary files differdeleted file mode 100644 index 1bb68ee..0000000 --- a/docs/pycharm/images/issue1.png +++ /dev/null diff --git a/docs/pycharm/images/issue2.png b/docs/pycharm/images/issue2.png Binary files differdeleted file mode 100644 index 174f6fd..0000000 --- a/docs/pycharm/images/issue2.png +++ /dev/null diff --git a/docs/users.rst b/docs/users.rst deleted file mode 100644 index 0fac7bf..0000000 --- a/docs/users.rst +++ /dev/null @@ -1,15 +0,0 @@ - .. _users: - -Users -====================================================================== - -Starting a new project, it’s highly recommended to set up a custom user model, -even if the default User model is sufficient for you. - -This model behaves identically to the default user model, -but you’ll be able to customize it in the future if the need arises. - -.. automodule:: alphabetlearning.users.models - :members: - :noindex: - diff --git a/local.yml b/local.yml deleted file mode 100644 index 1565704..0000000 --- a/local.yml +++ /dev/null @@ -1,75 +0,0 @@ -volumes: - alphabetlearning_local_postgres_data: {} - alphabetlearning_local_postgres_data_backups: {} - -services: - django: &django - build: - context: . - dockerfile: ./compose/local/django/Dockerfile - image: alphabetlearning_local_django - container_name: alphabetlearning_local_django - depends_on: - - postgres - - redis - - mailpit - volumes: - - .:/app:z - env_file: - - ./.envs/.local/.django - - ./.envs/.local/.postgres - ports: - - '8000:8000' - command: /start - - postgres: - build: - context: . - dockerfile: ./compose/production/postgres/Dockerfile - image: alphabetlearning_production_postgres - container_name: alphabetlearning_local_postgres - volumes: - - alphabetlearning_local_postgres_data:/var/lib/postgresql/data - - alphabetlearning_local_postgres_data_backups:/backups - env_file: - - ./.envs/.local/.postgres - - mailpit: - image: docker.io/axllent/mailpit:latest - container_name: alphabetlearning_local_mailpit - ports: - - "8025:8025" - - redis: - image: docker.io/redis:6 - container_name: alphabetlearning_local_redis - - celeryworker: - <<: *django - image: alphabetlearning_local_celeryworker - container_name: alphabetlearning_local_celeryworker - depends_on: - - redis - - postgres - - mailpit - ports: [] - command: /start-celeryworker - - celerybeat: - <<: *django - image: alphabetlearning_local_celerybeat - container_name: alphabetlearning_local_celerybeat - depends_on: - - redis - - postgres - - mailpit - ports: [] - command: /start-celerybeat - - flower: - <<: *django - image: alphabetlearning_local_flower - container_name: alphabetlearning_local_flower - ports: - - '5555:5555' - command: /start-flower diff --git a/locale/README.md b/locale/README.md deleted file mode 100644 index 9911fec..0000000 --- a/locale/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# Translations - -Start by configuring the `LANGUAGES` settings in `base.py`, by uncommenting languages you are willing to support. Then, translations strings will be placed in this folder when running: - -```bash -docker compose -f local.yml run --rm django python manage.py makemessages -all --no-location -``` - -This should generate `django.po` (stands for Portable Object) files under each locale `<locale name>/LC_MESSAGES/django.po`. Each translatable string in the codebase is collected with its `msgid` and need to be translated as `msgstr`, for example: - -```po -msgid "users" -msgstr "utilisateurs" -``` - -Once all translations are done, they need to be compiled into `.mo` files (stands for Machine Object), which are the actual binary files used by the application: - -```bash -docker compose -f local.yml run --rm django python manage.py compilemessages -``` - -Note that the `.po` files are NOT used by the application directly, so if the `.mo` files are out of dates, the content won't appear as translated even if the `.po` files are up-to-date. - -## Production - -The production image runs `compilemessages` automatically at build time, so as long as your translated source files (PO) are up-to-date, you're good to go. - -## Add a new language - -1. Update the [`LANGUAGES` setting](https://docs.djangoproject.com/en/stable/ref/settings/#std-setting-LANGUAGES) to your project's base settings. -2. Create the locale folder for the language next to this file, e.g. `fr_FR` for French. Make sure the case is correct. -3. Run `makemessages` (as instructed above) to generate the PO files for the new language. diff --git a/locale/en_US/LC_MESSAGES/django.po b/locale/en_US/LC_MESSAGES/django.po deleted file mode 100644 index 5730dc9..0000000 --- a/locale/en_US/LC_MESSAGES/django.po +++ /dev/null @@ -1,12 +0,0 @@ -# Translations for the pyblackbird-cc project -# Copyright (C) 2024 Matthew Lemon -# Matthew Lemon <y@yulqen.org>, 2024. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: 0.1.0\n" -"Language: en-US\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" diff --git a/locale/fr_FR/LC_MESSAGES/django.po b/locale/fr_FR/LC_MESSAGES/django.po deleted file mode 100644 index daac1e7..0000000 --- a/locale/fr_FR/LC_MESSAGES/django.po +++ /dev/null @@ -1,335 +0,0 @@ -# Translations for the pyblackbird-cc project -# Copyright (C) 2024 Matthew Lemon -# Matthew Lemon <y@yulqen.org>, 2024. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: 0.1.0\n" -"Language: fr-FR\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: alphabetlearning/templates/account/account_inactive.html:5 -#: alphabetlearning/templates/account/account_inactive.html:8 -msgid "Account Inactive" -msgstr "Compte inactif" - -#: alphabetlearning/templates/account/account_inactive.html:10 -msgid "This account is inactive." -msgstr "Ce compte est inactif." - -#: alphabetlearning/templates/account/email.html:7 -msgid "Account" -msgstr "Compte" - -#: alphabetlearning/templates/account/email.html:10 -msgid "E-mail Addresses" -msgstr "Adresses e-mail" - -#: alphabetlearning/templates/account/email.html:13 -msgid "The following e-mail addresses are associated with your account:" -msgstr "Les adresses e-mail suivantes sont associées à votre compte :" - -#: alphabetlearning/templates/account/email.html:27 -msgid "Verified" -msgstr "Vérifié" - -#: alphabetlearning/templates/account/email.html:29 -msgid "Unverified" -msgstr "Non vérifié" - -#: alphabetlearning/templates/account/email.html:31 -msgid "Primary" -msgstr "Primaire" - -#: alphabetlearning/templates/account/email.html:37 -msgid "Make Primary" -msgstr "Changer Primaire" - -#: alphabetlearning/templates/account/email.html:38 -msgid "Re-send Verification" -msgstr "Renvoyer vérification" - -#: alphabetlearning/templates/account/email.html:39 -msgid "Remove" -msgstr "Supprimer" - -#: alphabetlearning/templates/account/email.html:46 -msgid "Warning:" -msgstr "Avertissement:" - -#: alphabetlearning/templates/account/email.html:46 -msgid "" -"You currently do not have any e-mail address set up. You should really add " -"an e-mail address so you can receive notifications, reset your password, etc." -msgstr "" -"Vous n'avez actuellement aucune adresse e-mail configurée. Vous devriez ajouter " -"une adresse e-mail pour reçevoir des notifications, réinitialiser votre mot " -"de passe, etc." - -#: alphabetlearning/templates/account/email.html:51 -msgid "Add E-mail Address" -msgstr "Ajouter une adresse e-mail" - -#: alphabetlearning/templates/account/email.html:56 -msgid "Add E-mail" -msgstr "Ajouter e-mail" - -#: alphabetlearning/templates/account/email.html:66 -msgid "Do you really want to remove the selected e-mail address?" -msgstr "Voulez-vous vraiment supprimer l'adresse e-mail sélectionnée ?" - -#: alphabetlearning/templates/account/email_confirm.html:6 -#: alphabetlearning/templates/account/email_confirm.html:10 -msgid "Confirm E-mail Address" -msgstr "Confirmez votre adresse email" - -#: alphabetlearning/templates/account/email_confirm.html:16 -#, python-format -msgid "" -"Please confirm that <a href=\"mailto:%(email)s\">%(email)s</a> is an e-mail " -"address for user %(user_display)s." -msgstr "" -"Veuillez confirmer que <a href=\"mailto:%(email)s\">%(email)s</a> est un e-mail " -"adresse de l'utilisateur %(user_display)s." - -#: alphabetlearning/templates/account/email_confirm.html:20 -msgid "Confirm" -msgstr "Confirm" - -#: alphabetlearning/templates/account/email_confirm.html:27 -#, python-format -msgid "" -"This e-mail confirmation link expired or is invalid. Please <a href=" -"\"%(email_url)s\">issue a new e-mail confirmation request</a>." -msgstr "" -"Ce lien de confirmation par e-mail a expiré ou n'est pas valide. Veuillez" - "<a href=\"%(email_url)s\">émettre une nouvelle demande de confirmation " -"par e-mail</a>." - -#: alphabetlearning/templates/account/login.html:7 -#: alphabetlearning/templates/account/login.html:11 -#: alphabetlearning/templates/account/login.html:56 -#: alphabetlearning/templates/base.html:72 -msgid "Sign In" -msgstr "S'identifier" - -#: alphabetlearning/templates/account/login.html:17 -msgid "Please sign in with one of your existing third party accounts:" -msgstr "Veuillez vous connecter avec l'un de vos comptes tiers existants :" - -#: alphabetlearning/templates/account/login.html:19 -#, python-format -msgid "" -"Or, <a href=\"%(signup_url)s\">sign up</a> for a %(site_name)s account and " -"sign in below:" -msgstr "" -"Ou, <a href=\"%(signup_url)s\">créez</a> un compte %(site_name)s et " -"connectez-vous ci-dessous :" - -#: alphabetlearning/templates/account/login.html:32 -msgid "or" -msgstr "ou" - -#: alphabetlearning/templates/account/login.html:41 -#, python-format -msgid "" -"If you have not created an account yet, then please <a href=\"%(signup_url)s" -"\">sign up</a> first." -msgstr "" -"Si vous n'avez pas encore créé de compte, veuillez d'abord <a href=\"%(signup_url)s" -"\">vous inscrire</a>." - -#: alphabetlearning/templates/account/login.html:55 -msgid "Forgot Password?" -msgstr "Mot de passe oublié?" - -#: alphabetlearning/templates/account/logout.html:5 -#: alphabetlearning/templates/account/logout.html:8 -#: alphabetlearning/templates/account/logout.html:17 -#: alphabetlearning/templates/base.html:61 -msgid "Sign Out" -msgstr "Se déconnecter" - -#: alphabetlearning/templates/account/logout.html:10 -msgid "Are you sure you want to sign out?" -msgstr "Êtes-vous certain de vouloir vous déconnecter?" - -#: alphabetlearning/templates/account/password_change.html:6 -#: alphabetlearning/templates/account/password_change.html:9 -#: alphabetlearning/templates/account/password_change.html:14 -#: alphabetlearning/templates/account/password_reset_from_key.html:5 -#: alphabetlearning/templates/account/password_reset_from_key.html:8 -#: alphabetlearning/templates/account/password_reset_from_key_done.html:4 -#: alphabetlearning/templates/account/password_reset_from_key_done.html:7 -msgid "Change Password" -msgstr "Changer le mot de passe" - -#: alphabetlearning/templates/account/password_reset.html:7 -#: alphabetlearning/templates/account/password_reset.html:11 -#: alphabetlearning/templates/account/password_reset_done.html:6 -#: alphabetlearning/templates/account/password_reset_done.html:9 -msgid "Password Reset" -msgstr "Réinitialisation du mot de passe" - -#: alphabetlearning/templates/account/password_reset.html:16 -msgid "" -"Forgotten your password? Enter your e-mail address below, and we'll send you " -"an e-mail allowing you to reset it." -msgstr "" -"Mot de passe oublié? Entrez votre adresse e-mail ci-dessous, et nous vous " -"enverrons un e-mail vous permettant de le réinitialiser." - -#: alphabetlearning/templates/account/password_reset.html:21 -msgid "Reset My Password" -msgstr "Réinitialiser mon mot de passe" - -#: alphabetlearning/templates/account/password_reset.html:24 -msgid "Please contact us if you have any trouble resetting your password." -msgstr "" -"Veuillez nous contacter si vous rencontrez des difficultés pour réinitialiser" -"votre mot de passe." - -#: alphabetlearning/templates/account/password_reset_done.html:15 -msgid "" -"We have sent you an e-mail. Please contact us if you do not receive it " -"within a few minutes." -msgstr "" -"Nous vous avons envoyé un e-mail. Veuillez nous contacter si vous ne le " -"recevez pas d'ici quelques minutes." - -#: alphabetlearning/templates/account/password_reset_from_key.html:8 -msgid "Bad Token" -msgstr "Token Invalide" - -#: alphabetlearning/templates/account/password_reset_from_key.html:12 -#, python-format -msgid "" -"The password reset link was invalid, possibly because it has already been " -"used. Please request a <a href=\"%(passwd_reset_url)s\">new password reset</" -"a>." -msgstr "" -"Le lien de réinitialisation du mot de passe n'était pas valide, peut-être parce " -"qu'il a déjà été utilisé. Veuillez faire une <a href=\"%(passwd_reset_url)s\"> " -"nouvelle demande de réinitialisation de mot de passe</a>." - -#: alphabetlearning/templates/account/password_reset_from_key.html:18 -msgid "change password" -msgstr "changer le mot de passe" - -#: alphabetlearning/templates/account/password_reset_from_key.html:21 -#: alphabetlearning/templates/account/password_reset_from_key_done.html:8 -msgid "Your password is now changed." -msgstr "Votre mot de passe est maintenant modifié." - -#: alphabetlearning/templates/account/password_set.html:6 -#: alphabetlearning/templates/account/password_set.html:9 -#: alphabetlearning/templates/account/password_set.html:14 -msgid "Set Password" -msgstr "Définir le mot de passe" - -#: alphabetlearning/templates/account/signup.html:6 -msgid "Signup" -msgstr "S'inscrire" - -#: alphabetlearning/templates/account/signup.html:9 -#: alphabetlearning/templates/account/signup.html:19 -#: alphabetlearning/templates/base.html:67 -msgid "Sign Up" -msgstr "S'inscrire" - -#: alphabetlearning/templates/account/signup.html:11 -#, python-format -msgid "" -"Already have an account? Then please <a href=\"%(login_url)s\">sign in</a>." -msgstr "" -"Vous avez déjà un compte? Alors veuillez <a href=\"%(login_url)s\">vous connecter</a>." - -#: alphabetlearning/templates/account/signup_closed.html:5 -#: alphabetlearning/templates/account/signup_closed.html:8 -msgid "Sign Up Closed" -msgstr "Inscriptions closes" - -#: alphabetlearning/templates/account/signup_closed.html:10 -msgid "We are sorry, but the sign up is currently closed." -msgstr "Désolé, mais l'inscription est actuellement fermée." - -#: alphabetlearning/templates/account/verification_sent.html:5 -#: alphabetlearning/templates/account/verification_sent.html:8 -#: alphabetlearning/templates/account/verified_email_required.html:5 -#: alphabetlearning/templates/account/verified_email_required.html:8 -msgid "Verify Your E-mail Address" -msgstr "Vérifiez votre adresse e-mail" - -#: alphabetlearning/templates/account/verification_sent.html:10 -msgid "" -"We have sent an e-mail to you for verification. Follow the link provided to " -"finalize the signup process. Please contact us if you do not receive it " -"within a few minutes." -msgstr "Nous vous avons envoyé un e-mail pour vérification. Suivez le lien fourni " -"pour finalisez le processus d'inscription. Veuillez nous contacter si vous ne le " -"recevez pas d'ici quelques minutes." - -#: alphabetlearning/templates/account/verified_email_required.html:12 -msgid "" -"This part of the site requires us to verify that\n" -"you are who you claim to be. For this purpose, we require that you\n" -"verify ownership of your e-mail address. " -msgstr "" -"Cette partie du site nous oblige à vérifier que\n" -"vous êtes qui vous prétendez être. Nous vous demandons donc de\n" -"vérifier la propriété de votre adresse e-mail." - -#: alphabetlearning/templates/account/verified_email_required.html:16 -msgid "" -"We have sent an e-mail to you for\n" -"verification. Please click on the link inside this e-mail. Please\n" -"contact us if you do not receive it within a few minutes." -msgstr "" -"Nous vous avons envoyé un e-mail pour\n" -"vérification. Veuillez cliquer sur le lien contenu dans cet e-mail. Veuillez nous\n" -"contacter si vous ne le recevez pas d'ici quelques minutes." - -#: alphabetlearning/templates/account/verified_email_required.html:20 -#, python-format -msgid "" -"<strong>Note:</strong> you can still <a href=\"%(email_url)s\">change your e-" -"mail address</a>." -msgstr "" -"<strong>Remarque :</strong> vous pouvez toujours <a href=\"%(email_url)s\">changer votre e-" -"adresse e-mail</a>." - -#: alphabetlearning/templates/base.html:57 -msgid "My Profile" -msgstr "Mon Profil" - -#: alphabetlearning/users/admin.py:17 -msgid "Personal info" -msgstr "Personal info" - -#: alphabetlearning/users/admin.py:19 -msgid "Permissions" -msgstr "Permissions" - -#: alphabetlearning/users/admin.py:30 -msgid "Important dates" -msgstr "Dates importantes" - -#: alphabetlearning/users/apps.py:7 -msgid "Users" -msgstr "Utilisateurs" - -#: alphabetlearning/users/forms.py:24 -#: alphabetlearning/users/tests/test_forms.py:36 -msgid "This username has already been taken." -msgstr "Ce nom d'utilisateur est déjà pris." - -#: alphabetlearning/users/models.py:15 -msgid "Name of User" -msgstr "Nom de l'utilisateur" - -#: alphabetlearning/users/views.py:23 -msgid "Information successfully updated" -msgstr "Informations mises à jour avec succès" diff --git a/locale/pt_BR/LC_MESSAGES/django.po b/locale/pt_BR/LC_MESSAGES/django.po deleted file mode 100644 index 7ec3e9d..0000000 --- a/locale/pt_BR/LC_MESSAGES/django.po +++ /dev/null @@ -1,315 +0,0 @@ -# Translations for the pyblackbird-cc project -# Copyright (C) 2024 Matthew Lemon -# Matthew Lemon <y@yulqen.org>, 2024. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: 0.1.0\n" -"Language: pt-BR\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: alphabetlearning/templates/account/account_inactive.html:5 -#: alphabetlearning/templates/account/account_inactive.html:8 -msgid "Account Inactive" -msgstr "Conta Inativa" - -#: alphabetlearning/templates/account/account_inactive.html:10 -msgid "This account is inactive." -msgstr "Esta conta está inativa." - -#: alphabetlearning/templates/account/email.html:7 -msgid "Account" -msgstr "Conta" - -#: alphabetlearning/templates/account/email.html:10 -msgid "E-mail Addresses" -msgstr "Endereços de E-mail" - -#: alphabetlearning/templates/account/email.html:13 -msgid "The following e-mail addresses are associated with your account:" -msgstr "Os seguintes endereços de e-mail estão associados à sua conta:" - -#: alphabetlearning/templates/account/email.html:27 -msgid "Verified" -msgstr "Verificado" - -#: alphabetlearning/templates/account/email.html:29 -msgid "Unverified" -msgstr "Não verificado" - -#: alphabetlearning/templates/account/email.html:31 -msgid "Primary" -msgstr "Primário" - -#: alphabetlearning/templates/account/email.html:37 -msgid "Make Primary" -msgstr "Tornar Primário" - -#: alphabetlearning/templates/account/email.html:38 -msgid "Re-send Verification" -msgstr "Reenviar verificação" - -#: alphabetlearning/templates/account/email.html:39 -msgid "Remove" -msgstr "Remover" - -#: alphabetlearning/templates/account/email.html:46 -msgid "Warning:" -msgstr "Aviso:" - -#: alphabetlearning/templates/account/email.html:46 -msgid "" -"You currently do not have any e-mail address set up. You should really add " -"an e-mail address so you can receive notifications, reset your password, etc." -msgstr "" -"No momento, você não tem nenhum endereço de e-mail configurado. Você " -"realmente deve adicionar um endereço de e-mail para receber notificações, " -"redefinir sua senha etc." - -#: alphabetlearning/templates/account/email.html:51 -msgid "Add E-mail Address" -msgstr "Adicionar Endereço de E-mail" - -#: alphabetlearning/templates/account/email.html:56 -msgid "Add E-mail" -msgstr "Adicionar E-mail" - -#: alphabetlearning/templates/account/email.html:66 -msgid "Do you really want to remove the selected e-mail address?" -msgstr "Você realmente deseja remover o endereço de e-mail selecionado?" - -#: alphabetlearning/templates/account/email_confirm.html:6 -#: alphabetlearning/templates/account/email_confirm.html:10 -msgid "Confirm E-mail Address" -msgstr "Confirme o endereço de e-mail" - -#: alphabetlearning/templates/account/email_confirm.html:16 -#, python-format -msgid "" -"Please confirm that <a href=\"mailto:%(email)s\">%(email)s</a> is an e-mail " -"address for user %(user_display)s." -msgstr "" -"Confirme se <a href=\"mailto:%(email)s\">%(email)s</a> é um endereço de " -"e-mail do usuário %(user_display)s." - -#: alphabetlearning/templates/account/email_confirm.html:20 -msgid "Confirm" -msgstr "Confirmar" - -#: alphabetlearning/templates/account/email_confirm.html:27 -#, python-format -msgid "" -"This e-mail confirmation link expired or is invalid. Please <a href=" -"\"%(email_url)s\">issue a new e-mail confirmation request</a>." -msgstr "Este link de confirmação de e-mail expirou ou é inválido. " -"Por favor, <a href=\"%(email_url)s\">emita um novo pedido de confirmação por e-mail</a>." - -#: alphabetlearning/templates/account/login.html:7 -#: alphabetlearning/templates/account/login.html:11 -#: alphabetlearning/templates/account/login.html:56 -#: alphabetlearning/templates/base.html:72 -msgid "Sign In" -msgstr "Entrar" - -#: alphabetlearning/templates/account/login.html:17 -msgid "Please sign in with one of your existing third party accounts:" -msgstr "Faça login com uma de suas contas de terceiros existentes:" - -#: alphabetlearning/templates/account/login.html:19 -#, python-format -msgid "" -"Or, <a href=\"%(signup_url)s\">sign up</a> for a %(site_name)s account and " -"sign in below:" -msgstr "Ou, <a href=\"%(signup_url)s\">cadastre-se</a> para uma conta em %(site_name)s e entre abaixo:" - -#: alphabetlearning/templates/account/login.html:32 -msgid "or" -msgstr "ou" - -#: alphabetlearning/templates/account/login.html:41 -#, python-format -msgid "" -"If you have not created an account yet, then please <a href=\"%(signup_url)s" -"\">sign up</a> first." -msgstr "Se você ainda não criou uma conta, <a href=\"%(signup_url)s" -"\">registre-se primeiro</a>." - -#: alphabetlearning/templates/account/login.html:55 -msgid "Forgot Password?" -msgstr "Esqueceu sua senha?" - -#: alphabetlearning/templates/account/logout.html:5 -#: alphabetlearning/templates/account/logout.html:8 -#: alphabetlearning/templates/account/logout.html:17 -#: alphabetlearning/templates/base.html:61 -msgid "Sign Out" -msgstr "Sair" - -#: alphabetlearning/templates/account/logout.html:10 -msgid "Are you sure you want to sign out?" -msgstr "Você tem certeza que deseja sair?" - -#: alphabetlearning/templates/account/password_change.html:6 -#: alphabetlearning/templates/account/password_change.html:9 -#: alphabetlearning/templates/account/password_change.html:14 -#: alphabetlearning/templates/account/password_reset_from_key.html:5 -#: alphabetlearning/templates/account/password_reset_from_key.html:8 -#: alphabetlearning/templates/account/password_reset_from_key_done.html:4 -#: alphabetlearning/templates/account/password_reset_from_key_done.html:7 -msgid "Change Password" -msgstr "Alterar Senha" - -#: alphabetlearning/templates/account/password_reset.html:7 -#: alphabetlearning/templates/account/password_reset.html:11 -#: alphabetlearning/templates/account/password_reset_done.html:6 -#: alphabetlearning/templates/account/password_reset_done.html:9 -msgid "Password Reset" -msgstr "Redefinição de senha" - -#: alphabetlearning/templates/account/password_reset.html:16 -msgid "" -"Forgotten your password? Enter your e-mail address below, and we'll send you " -"an e-mail allowing you to reset it." -msgstr "Esqueceu sua senha? Digite seu endereço de e-mail abaixo e enviaremos um e-mail permitindo que você o redefina." - -#: alphabetlearning/templates/account/password_reset.html:21 -msgid "Reset My Password" -msgstr "Redefinir minha senha" - -#: alphabetlearning/templates/account/password_reset.html:24 -msgid "Please contact us if you have any trouble resetting your password." -msgstr "Entre em contato conosco se tiver algum problema para redefinir sua senha." - -#: alphabetlearning/templates/account/password_reset_done.html:15 -msgid "" -"We have sent you an e-mail. Please contact us if you do not receive it " -"within a few minutes." -msgstr "Enviamos um e-mail para você. Entre em contato conosco se você não recebê-lo dentro de alguns minutos." - -#: alphabetlearning/templates/account/password_reset_from_key.html:8 -msgid "Bad Token" -msgstr "Token Inválido" - -#: alphabetlearning/templates/account/password_reset_from_key.html:12 -#, python-format -msgid "" -"The password reset link was invalid, possibly because it has already been " -"used. Please request a <a href=\"%(passwd_reset_url)s\">new password reset</" -"a>." -msgstr "O link de redefinição de senha era inválido, possivelmente porque já foi usado. " -"<a href=\"%(passwd_reset_url)s\">Solicite uma nova redefinição de senha</a>." - -#: alphabetlearning/templates/account/password_reset_from_key.html:18 -msgid "change password" -msgstr "alterar senha" - -#: alphabetlearning/templates/account/password_reset_from_key.html:21 -#: alphabetlearning/templates/account/password_reset_from_key_done.html:8 -msgid "Your password is now changed." -msgstr "Sua senha agora foi alterada." - -#: alphabetlearning/templates/account/password_set.html:6 -#: alphabetlearning/templates/account/password_set.html:9 -#: alphabetlearning/templates/account/password_set.html:14 -msgid "Set Password" -msgstr "Definir Senha" - -#: alphabetlearning/templates/account/signup.html:6 -msgid "Signup" -msgstr "Cadastro" - -#: alphabetlearning/templates/account/signup.html:9 -#: alphabetlearning/templates/account/signup.html:19 -#: alphabetlearning/templates/base.html:67 -msgid "Sign Up" -msgstr "Cadastro" - -#: alphabetlearning/templates/account/signup.html:11 -#, python-format -msgid "" -"Already have an account? Then please <a href=\"%(login_url)s\">sign in</a>." -msgstr "já tem uma conta? Então, por favor, faça <a href=\"%(login_url)s\">login</a>." - -#: alphabetlearning/templates/account/signup_closed.html:5 -#: alphabetlearning/templates/account/signup_closed.html:8 -msgid "Sign Up Closed" -msgstr "Inscrições encerradas" - -#: alphabetlearning/templates/account/signup_closed.html:10 -msgid "We are sorry, but the sign up is currently closed." -msgstr "Lamentamos, mas as inscrições estão encerradas no momento." - -#: alphabetlearning/templates/account/verification_sent.html:5 -#: alphabetlearning/templates/account/verification_sent.html:8 -#: alphabetlearning/templates/account/verified_email_required.html:5 -#: alphabetlearning/templates/account/verified_email_required.html:8 -msgid "Verify Your E-mail Address" -msgstr "Verifique seu endereço de e-mail" - -#: alphabetlearning/templates/account/verification_sent.html:10 -msgid "" -"We have sent an e-mail to you for verification. Follow the link provided to " -"finalize the signup process. Please contact us if you do not receive it " -"within a few minutes." -msgstr "Enviamos um e-mail para você para verificação. Siga o link fornecido para finalizar o processo de inscrição. Entre em contato conosco se você não recebê-lo dentro de alguns minutos." - -#: alphabetlearning/templates/account/verified_email_required.html:12 -msgid "" -"This part of the site requires us to verify that\n" -"you are who you claim to be. For this purpose, we require that you\n" -"verify ownership of your e-mail address. " -msgstr "Esta parte do site exige que verifiquemos se você é quem afirma ser.\n" -"Para esse fim, exigimos que você verifique a propriedade\n" -"do seu endereço de e-mail." - -#: alphabetlearning/templates/account/verified_email_required.html:16 -msgid "" -"We have sent an e-mail to you for\n" -"verification. Please click on the link inside this e-mail. Please\n" -"contact us if you do not receive it within a few minutes." -msgstr "Enviamos um e-mail para você para verificação.\n" -"Por favor, clique no link dentro deste e-mail.\n" -"Entre em contato conosco se você não recebê-lo dentro de alguns minutos." - -#: alphabetlearning/templates/account/verified_email_required.html:20 -#, python-format -msgid "" -"<strong>Note:</strong> you can still <a href=\"%(email_url)s\">change your e-" -"mail address</a>." -msgstr "<strong>Nota</strong>: você ainda pode <a href=\"%(email_url)s\">alterar seu endereço de e-mail</a>." - -#: alphabetlearning/templates/base.html:57 -msgid "My Profile" -msgstr "Meu perfil" - -#: alphabetlearning/users/admin.py:17 -msgid "Personal info" -msgstr "Informação pessoal" - -#: alphabetlearning/users/admin.py:19 -msgid "Permissions" -msgstr "Permissões" - -#: alphabetlearning/users/admin.py:30 -msgid "Important dates" -msgstr "Datas importantes" - -#: alphabetlearning/users/apps.py:7 -msgid "Users" -msgstr "Usuários" - -#: alphabetlearning/users/forms.py:24 -#: alphabetlearning/users/tests/test_forms.py:36 -msgid "This username has already been taken." -msgstr "Este nome de usuário já foi usado." - -#: alphabetlearning/users/models.py:15 -msgid "Name of User" -msgstr "Nome do Usuário" - -#: alphabetlearning/users/views.py:23 -msgid "Information successfully updated" -msgstr "Informação atualizada com sucesso" diff --git a/merge_production_dotenvs_in_dotenv.py b/merge_production_dotenvs_in_dotenv.py deleted file mode 100644 index c83ed71..0000000 --- a/merge_production_dotenvs_in_dotenv.py +++ /dev/null @@ -1,27 +0,0 @@ -# ruff: noqa -import os -from collections.abc import Sequence -from pathlib import Path - -BASE_DIR = Path(__file__).parent.resolve() -PRODUCTION_DOTENVS_DIR = BASE_DIR / ".envs" / ".production" -PRODUCTION_DOTENV_FILES = [ - PRODUCTION_DOTENVS_DIR / ".django", - PRODUCTION_DOTENVS_DIR / ".postgres", -] -DOTENV_FILE = BASE_DIR / ".env" - - -def merge( - output_file: Path, - files_to_merge: Sequence[Path], -) -> None: - merged_content = "" - for merge_file in files_to_merge: - merged_content += merge_file.read_text() - merged_content += os.linesep - output_file.write_text(merged_content) - - -if __name__ == "__main__": - merge(DOTENV_FILE, PRODUCTION_DOTENV_FILES) diff --git a/pyproject.toml b/pyproject.toml index d09d98b..74d1503 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,5 @@ [project] +requires-python = ">=3.11" name = "alphabetlearning" version = "0.1.0" dependencies = [ @@ -10,22 +11,12 @@ dependencies = [ # https://github.com/hynek/argon2_cffi "whitenoise==6.6.0", # https://github.com/evansd/whitenoise - "redis==5.0.4", - # https://github.com/redis/redis-py - "hiredis==2.3.2", - # https://github.com/redis/hiredis-py - "celery==5.4.0", - # pyup: < 6.0 # https://github.com/celery/celery - "django-celery-beat==2.6.0", - # https://github.com/celery/django-celery-beat - "flower==2.0.1", - # https://github.com/mher/flower "botocore~=1.34.93", # Django # ------------------------------------------------------------------------------ "django-storages==1.14.3", "gunicorn==22.0.0", - "Django==5.0.4", + "Django==5.1.4", # pyup: < 5.0 # https://www.djangoproject.com/ "django-environ==0.11.2", # https://github.com/joke2k/django-environ @@ -43,31 +34,30 @@ dependencies = [ "pdf2image==1.17.0", "pypdf2==3.0.1", "python-magic==0.4.27", - "python-dotenv==1.0.1", + #"python-dotenv==1.0.1", "boto3==1.34.89", "sqlparse==0.5.0", "markdown==3.6.0", "Werkzeug[watchdog]==3.0.2", - # https://github.com/pallets/werkzeug - "psycopg[c]==3.1.19", # https://github.com/psycopg/psycopg "watchfiles==0.21.0", # https://github.com/samuelcolvin/watchfiles "stripe==11.1.0", "django-stubs[compatible-mypy]>=5.0.4", - "django-ratelimit==4.1.0", - "django-recaptcha==4.0.0" + # "django-ratelimit==4.1.0", + "django-recaptcha==4.0.0", ] [tool.uv] # https://docs.astral.sh/uv/concepts/dependencies/#development-dependencies dev-dependencies = [ - "factory-boy==3.3.0", # https://github.com/FactoryBoy/factory_boy - "django-coverage-plugin==3.1.0", # https://github.com/nedbat/django_coverage_plugin - "pytest-django==4.8.0", # https://github.com/pytest-dev/pytest-django - "ruff==0.6.4", # https://github.com/astral-sh/ruff - "coverage==7.5.1", # https://github.com/nedbat/coveragepy - "pytest==8.2.0", # https://github.com/pytest-dev/pytest - "pytest-sugar==1.0.0", # https://github.com/Frozenball/pytest-sugar - "pdbpp==0.10.3" + "factory-boy==3.3.0", # https://github.com/FactoryBoy/factory_boy + "django-coverage-plugin==3.1.0", # https://github.com/nedbat/django_coverage_plugin + "pytest-django==4.8.0", # https://github.com/pytest-dev/pytest-django + "ruff==0.6.4", # https://github.com/astral-sh/ruff + "coverage==7.5.1", # https://github.com/nedbat/coveragepy + "pytest==8.2.0", # https://github.com/pytest-dev/pytest + "pytest-sugar==1.0.0", # https://github.com/Frozenball/pytest-sugar + "pdbpp==0.10.3", + "isort>=5.13.2", ] # ==== pytest ==== @@ -146,6 +136,7 @@ target-version = "py312" select = ["E", "F", "B", "SIM", "I"] ignore = [ "E501", # line length! + "I001", # imports - we are going to let isort do it "TRY003", "RUF001", "COM812", @@ -171,6 +162,7 @@ extend-unsafe-fixes = [ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" [tool.ruff.format] +line-length = 150 quote-style = "double" indent-style = "space" skip-magic-trailing-comma = false diff --git a/requirements.txt b/requirements.txt index e69f1e6..973627b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,207 +1,59 @@ # This file was autogenerated by uv via the following command: -# uv pip compile pyproject.toml -o requirements.txt -amqp==5.2.0 - # via kombu +# uv export --no-dev --no-hashes --format requirements-txt anyio==4.4.0 - # via watchfiles argon2-cffi==23.1.0 - # via pyblackbird-cc (pyproject.toml) argon2-cffi-bindings==21.2.0 - # via argon2-cffi asgiref==3.8.1 - # via - # django - # django-stubs -async-timeout==4.0.3 - # via redis -billiard==4.2.0 - # via celery +async-timeout==4.0.3 ; python_full_version < '3.11.3' boto3==1.34.89 - # via pyblackbird-cc (pyproject.toml) botocore==1.34.162 - # via - # pyblackbird-cc (pyproject.toml) - # boto3 - # s3transfer -celery==5.4.0 - # via - # pyblackbird-cc (pyproject.toml) - # django-celery-beat - # flower certifi==2024.8.30 - # via requests cffi==1.17.1 - # via argon2-cffi-bindings charset-normalizer==3.3.2 - # via requests -click==8.1.7 - # via - # celery - # click-didyoumean - # click-plugins - # click-repl -click-didyoumean==0.3.1 - # via celery -click-plugins==1.1.1 - # via celery -click-repl==0.3.0 - # via celery +colorama==0.4.6 ; sys_platform == 'win32' crispy-bootstrap5==2024.2 - # via pyblackbird-cc (pyproject.toml) -cron-descriptor==1.4.5 - # via django-celery-beat -django==5.0.4 - # via - # pyblackbird-cc (pyproject.toml) - # crispy-bootstrap5 - # django-allauth - # django-celery-beat - # django-crispy-forms - # django-model-utils - # django-redis - # django-storages - # django-stubs - # django-stubs-ext - # django-timezone-field +django==5.1.4 django-allauth==0.62.1 - # via pyblackbird-cc (pyproject.toml) -django-celery-beat==2.6.0 - # via pyblackbird-cc (pyproject.toml) django-crispy-forms==2.1 - # via - # pyblackbird-cc (pyproject.toml) - # crispy-bootstrap5 django-environ==0.11.2 - # via pyblackbird-cc (pyproject.toml) django-model-utils==4.5.1 - # via pyblackbird-cc (pyproject.toml) +django-recaptcha==4.0.0 django-redis==5.4.0 - # via pyblackbird-cc (pyproject.toml) django-storages==1.14.3 - # via pyblackbird-cc (pyproject.toml) django-stubs==5.0.4 - # via pyblackbird-cc (pyproject.toml) django-stubs-ext==5.0.4 - # via django-stubs -django-timezone-field==7.0 - # via django-celery-beat -flower==2.0.1 - # via pyblackbird-cc (pyproject.toml) gunicorn==22.0.0 - # via pyblackbird-cc (pyproject.toml) -hiredis==2.3.2 - # via pyblackbird-cc (pyproject.toml) -humanize==4.10.0 - # via flower idna==3.8 - # via - # anyio - # requests jmespath==1.0.1 - # via - # boto3 - # botocore -kombu==5.4.1 - # via celery markdown==3.6 - # via pyblackbird-cc (pyproject.toml) markupsafe==2.1.5 - # via werkzeug mypy==1.11.2 - # via django-stubs mypy-extensions==1.0.0 - # via mypy packaging==24.1 - # via gunicorn pdf2image==1.17.0 - # via pyblackbird-cc (pyproject.toml) pillow==10.3.0 - # via - # pyblackbird-cc (pyproject.toml) - # pdf2image -prometheus-client==0.20.0 - # via flower -prompt-toolkit==3.0.47 - # via click-repl psycopg==3.1.19 - # via pyblackbird-cc (pyproject.toml) -psycopg-c==3.1.19 - # via psycopg +psycopg-c==3.1.19 ; implementation_name != 'pypy' pycparser==2.22 - # via cffi pypdf2==3.0.1 - # via pyblackbird-cc (pyproject.toml) pypng==0.20220715.0 - # via qrcode -python-crontab==3.2.0 - # via django-celery-beat python-dateutil==2.9.0.post0 - # via - # botocore - # celery - # python-crontab -python-dotenv==1.0.1 - # via pyblackbird-cc (pyproject.toml) python-magic==0.4.27 - # via pyblackbird-cc (pyproject.toml) python-slugify==8.0.4 - # via pyblackbird-cc (pyproject.toml) -pytz==2024.2 - # via flower qrcode==7.4.2 - # via django-allauth redis==5.0.4 - # via - # pyblackbird-cc (pyproject.toml) - # django-redis requests==2.32.3 - # via stripe s3transfer==0.10.2 - # via boto3 six==1.16.0 - # via python-dateutil sniffio==1.3.1 - # via anyio sqlparse==0.5.0 - # via - # pyblackbird-cc (pyproject.toml) - # django -stripe==10.10.0 - # via pyblackbird-cc (pyproject.toml) +stripe==11.1.0 text-unidecode==1.3 - # via python-slugify -tornado==6.4.1 - # via flower types-pyyaml==6.0.12.20240808 - # via django-stubs typing-extensions==4.12.2 - # via - # django-stubs - # django-stubs-ext - # mypy - # psycopg - # qrcode - # stripe -tzdata==2024.1 - # via - # celery - # django-celery-beat -urllib3==2.2.3 - # via - # botocore - # requests -vine==5.1.0 - # via - # amqp - # celery - # kombu +tzdata==2024.1 ; sys_platform == 'win32' +urllib3==2.2.2 watchdog==5.0.2 - # via werkzeug watchfiles==0.21.0 - # via pyblackbird-cc (pyproject.toml) -wcwidth==0.2.13 - # via prompt-toolkit werkzeug==3.0.2 - # via pyblackbird-cc (pyproject.toml) whitenoise==6.6.0 - # via pyblackbird-cc (pyproject.toml) diff --git a/requirements/base.txt b/requirements/base.txt deleted file mode 100644 index 51b046e..0000000 --- a/requirements/base.txt +++ /dev/null @@ -1,30 +0,0 @@ -python-slugify==8.0.4 # https://github.com/un33k/python-slugify -pillow==10.3.0 # https://github.com/python-pillow/Pillow -argon2-cffi==23.1.0 # https://github.com/hynek/argon2_cffi -whitenoise==6.6.0 # https://github.com/evansd/whitenoise -redis==5.0.4 # https://github.com/redis/redis-py -hiredis==2.3.2 # https://github.com/redis/hiredis-py -celery==5.4.0 # pyup: < 6.0 # https://github.com/celery/celery -django-celery-beat==2.6.0 # https://github.com/celery/django-celery-beat -flower==2.0.1 # https://github.com/mher/flower - -# migrated stuff from pyblackbird -pdf2image==1.17.0 -pypdf2==3.0.1 -python-magic==0.4.27 -python-dotenv==1.0.1 -boto3==1.34.89 -sqlparse==0.5.0 - -markdown==3.6.0 - -# Django -# ------------------------------------------------------------------------------ -django-storages==1.14.3 -Django==5.0.4 # pyup: < 5.0 # https://www.djangoproject.com/ -django-environ==0.11.2 # https://github.com/joke2k/django-environ -django-model-utils==4.5.1 # https://github.com/jazzband/django-model-utils -django-allauth[mfa]==0.62.1 # https://github.com/pennersr/django-allauth -django-crispy-forms==2.1 # https://github.com/django-crispy-forms/django-crispy-forms -crispy-bootstrap5==2024.2 # https://github.com/django-crispy-forms/crispy-bootstrap5 -django-redis==5.4.0 # https://github.com/jazzband/django-redis diff --git a/requirements/local.txt b/requirements/local.txt deleted file mode 100644 index d6a27d9..0000000 --- a/requirements/local.txt +++ /dev/null @@ -1,207 +0,0 @@ -# This file was autogenerated by uv via the following command: -# uv pip compile pyproject.toml -o requirements/local.txt -amqp==5.2.0 - # via kombu -anyio==4.4.0 - # via watchfiles -argon2-cffi==23.1.0 - # via pyblackbird-cc (pyproject.toml) -argon2-cffi-bindings==21.2.0 - # via argon2-cffi -asgiref==3.8.1 - # via - # django - # django-stubs -async-timeout==4.0.3 - # via redis -billiard==4.2.0 - # via celery -boto3==1.34.89 - # via pyblackbird-cc (pyproject.toml) -botocore==1.34.162 - # via - # pyblackbird-cc (pyproject.toml) - # boto3 - # s3transfer -celery==5.4.0 - # via - # pyblackbird-cc (pyproject.toml) - # django-celery-beat - # flower -certifi==2024.8.30 - # via requests -cffi==1.17.1 - # via argon2-cffi-bindings -charset-normalizer==3.3.2 - # via requests -click==8.1.7 - # via - # celery - # click-didyoumean - # click-plugins - # click-repl -click-didyoumean==0.3.1 - # via celery -click-plugins==1.1.1 - # via celery -click-repl==0.3.0 - # via celery -crispy-bootstrap5==2024.2 - # via pyblackbird-cc (pyproject.toml) -cron-descriptor==1.4.5 - # via django-celery-beat -django==5.0.4 - # via - # pyblackbird-cc (pyproject.toml) - # crispy-bootstrap5 - # django-allauth - # django-celery-beat - # django-crispy-forms - # django-model-utils - # django-redis - # django-storages - # django-stubs - # django-stubs-ext - # django-timezone-field -django-allauth==0.62.1 - # via pyblackbird-cc (pyproject.toml) -django-celery-beat==2.6.0 - # via pyblackbird-cc (pyproject.toml) -django-crispy-forms==2.1 - # via - # pyblackbird-cc (pyproject.toml) - # crispy-bootstrap5 -django-environ==0.11.2 - # via pyblackbird-cc (pyproject.toml) -django-model-utils==4.5.1 - # via pyblackbird-cc (pyproject.toml) -django-redis==5.4.0 - # via pyblackbird-cc (pyproject.toml) -django-storages==1.14.3 - # via pyblackbird-cc (pyproject.toml) -django-stubs==5.0.4 - # via pyblackbird-cc (pyproject.toml) -django-stubs-ext==5.0.4 - # via django-stubs -django-timezone-field==7.0 - # via django-celery-beat -flower==2.0.1 - # via pyblackbird-cc (pyproject.toml) -gunicorn==22.0.0 - # via pyblackbird-cc (pyproject.toml) -hiredis==2.3.2 - # via pyblackbird-cc (pyproject.toml) -humanize==4.10.0 - # via flower -idna==3.8 - # via - # anyio - # requests -jmespath==1.0.1 - # via - # boto3 - # botocore -kombu==5.4.1 - # via celery -markdown==3.6 - # via pyblackbird-cc (pyproject.toml) -markupsafe==2.1.5 - # via werkzeug -mypy==1.11.2 - # via django-stubs -mypy-extensions==1.0.0 - # via mypy -packaging==24.1 - # via gunicorn -pdf2image==1.17.0 - # via pyblackbird-cc (pyproject.toml) -pillow==10.3.0 - # via - # pyblackbird-cc (pyproject.toml) - # pdf2image -prometheus-client==0.20.0 - # via flower -prompt-toolkit==3.0.47 - # via click-repl -psycopg==3.1.19 - # via pyblackbird-cc (pyproject.toml) -psycopg-c==3.1.19 - # via psycopg -pycparser==2.22 - # via cffi -pypdf2==3.0.1 - # via pyblackbird-cc (pyproject.toml) -pypng==0.20220715.0 - # via qrcode -python-crontab==3.2.0 - # via django-celery-beat -python-dateutil==2.9.0.post0 - # via - # botocore - # celery - # python-crontab -python-dotenv==1.0.1 - # via pyblackbird-cc (pyproject.toml) -python-magic==0.4.27 - # via pyblackbird-cc (pyproject.toml) -python-slugify==8.0.4 - # via pyblackbird-cc (pyproject.toml) -pytz==2024.2 - # via flower -qrcode==7.4.2 - # via django-allauth -redis==5.0.4 - # via - # pyblackbird-cc (pyproject.toml) - # django-redis -requests==2.32.3 - # via stripe -s3transfer==0.10.2 - # via boto3 -six==1.16.0 - # via python-dateutil -sniffio==1.3.1 - # via anyio -sqlparse==0.5.0 - # via - # pyblackbird-cc (pyproject.toml) - # django -stripe==10.10.0 - # via pyblackbird-cc (pyproject.toml) -text-unidecode==1.3 - # via python-slugify -tornado==6.4.1 - # via flower -types-pyyaml==6.0.12.20240808 - # via django-stubs -typing-extensions==4.12.2 - # via - # django-stubs - # django-stubs-ext - # mypy - # psycopg - # qrcode - # stripe -tzdata==2024.1 - # via - # celery - # django-celery-beat -urllib3==2.2.2 - # via - # botocore - # requests -vine==5.1.0 - # via - # amqp - # celery - # kombu -watchdog==5.0.2 - # via werkzeug -watchfiles==0.21.0 - # via pyblackbird-cc (pyproject.toml) -wcwidth==0.2.13 - # via prompt-toolkit -werkzeug==3.0.2 - # via pyblackbird-cc (pyproject.toml) -whitenoise==6.6.0 - # via pyblackbird-cc (pyproject.toml) diff --git a/requirements/production.txt b/requirements/production.txt deleted file mode 100644 index 9024883..0000000 --- a/requirements/production.txt +++ /dev/null @@ -1,12 +0,0 @@ -# PRECAUTION: avoid production dependencies that aren't in development - --r base.txt - -gunicorn==22.0.0 # https://github.com/benoitc/gunicorn -psycopg[c]==3.1.19 # https://github.com/psycopg/psycopg -sentry-sdk==2.1.1 # https://github.com/getsentry/sentry-python - -# Django -# ------------------------------------------------------------------------------ -django-storages[s3]==1.14.3 # https://github.com/jschneier/django-storages -django-anymail[mailgun]==10.3 # https://github.com/anymail/django-anymail diff --git a/scripts/deploy.pl b/scripts/deploy.pl deleted file mode 100644 index 81f3957..0000000 --- a/scripts/deploy.pl +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env -S perl -w - -use warnings; -use strict; - -# Get environment variables from .env file -print "The .env-prod file is critical for the deployment.\n"; -print ".env file exists in the project directory.\n" if -e "../.env"; -print "It contains the following environment variables:\n\n"; - -my $live_db_url; -my $commented_db_url; - -open my $envf, "<", "../.env" or die "Cannot open .env file: $!"; -while ( my $line = <$envf>) { - # TODO fix this regex - it will omit commented lines to start with - if ($line =~ /^[A-Z_]+=/) { - if ($line =~ /^DATABASE_URL/) { - my @live_url = split(/=/, $line); - $live_db_url = $live_url[1]; - } - if ($line =~ /^#DATABASE_URL/) { - my @commented_url = split(/=/, $line); - $commented_db_url = $commented_url[1]; - } - print $line; - } -} - -print "\n\nDATABASE_URL is $live_db_url"; -print "\n\nCommented DATABASE_URL is $commented_db_url" if defined; - - -close($envf); diff --git a/scripts/deploy.sh b/scripts/deploy.sh deleted file mode 100755 index b7ecf74..0000000 --- a/scripts/deploy.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# Assign arguments to variables -IMAGE_NAME="pyblackbird" -TAG="latest" # Adjust tagging strategy as needed -DOCKER_REGISTRY="registry.gitlab.com/yulqen" # Docker registry URL - -SERVER_HOST="substracker-web" - -# SSH into server to pull the image, restart the container, and configure NGINX and Certbot -#ssh -i $SSH_KEY_PATH $SSH_USER@$SERVER_HOST << EOF -ssh $SERVER_HOST << EOF - -# Stop and remove the existing container if it exists -docker stop $IMAGE_NAME || true -docker rm $IMAGE_NAME || true -docker rmi $DOCKER_REGISTRY/$IMAGE_NAME:$TAG || true - -# run using the .env file for config settings -cd code/pyblackbird && docker run -d --rm --name pyblackbird --mount type=bind,src=/home/surge/code/pyblackbird/data,dst=/app/data --env-file .env -p 8080:8080 $DOCKER_REGISTRY/$IMAGE_NAME:$TAG - -EOF - -echo "Deployment complete." diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/tests/__init__.py +++ /dev/null diff --git a/tests/test_merge_production_dotenvs_in_dotenv.py b/tests/test_merge_production_dotenvs_in_dotenv.py deleted file mode 100644 index c0e68f6..0000000 --- a/tests/test_merge_production_dotenvs_in_dotenv.py +++ /dev/null @@ -1,34 +0,0 @@ -from pathlib import Path - -import pytest - -from merge_production_dotenvs_in_dotenv import merge - - -@pytest.mark.parametrize( - ("input_contents", "expected_output"), - [ - ([], ""), - ([""], "\n"), - (["JANE=doe"], "JANE=doe\n"), - (["SEP=true", "AR=ator"], "SEP=true\nAR=ator\n"), - (["A=0", "B=1", "C=2"], "A=0\nB=1\nC=2\n"), - (["X=x\n", "Y=y", "Z=z\n"], "X=x\n\nY=y\nZ=z\n\n"), - ], -) -def test_merge( - tmp_path: Path, - input_contents: list[str], - expected_output: str, -): - output_file = tmp_path / ".env" - - files_to_merge = [] - for num, input_content in enumerate(input_contents, start=1): - merge_file = tmp_path / f".service{num}" - merge_file.write_text(input_content) - files_to_merge.append(merge_file) - - merge(output_file, files_to_merge) - - assert output_file.read_text() == expected_output @@ -9,31 +9,23 @@ dependencies = [ { name = "argon2-cffi" }, { name = "boto3" }, { name = "botocore" }, - { name = "celery" }, { name = "crispy-bootstrap5" }, { name = "django" }, { name = "django-allauth", extra = ["mfa"] }, - { name = "django-celery-beat" }, { name = "django-crispy-forms" }, { name = "django-environ" }, { name = "django-model-utils" }, - { name = "django-ratelimit" }, { name = "django-recaptcha" }, { name = "django-redis" }, { name = "django-storages" }, { name = "django-stubs", extra = ["compatible-mypy"] }, - { name = "flower" }, { name = "gunicorn" }, - { name = "hiredis" }, { name = "markdown" }, { name = "pdf2image" }, { name = "pillow" }, - { name = "psycopg", extra = ["c"] }, { name = "pypdf2" }, - { name = "python-dotenv" }, { name = "python-magic" }, { name = "python-slugify" }, - { name = "redis" }, { name = "sqlparse" }, { name = "stripe" }, { name = "watchfiles" }, @@ -46,6 +38,7 @@ dev = [ { name = "coverage" }, { name = "django-coverage-plugin" }, { name = "factory-boy" }, + { name = "isort" }, { name = "pdbpp" }, { name = "pytest" }, { name = "pytest-django" }, @@ -58,31 +51,23 @@ requires-dist = [ { name = "argon2-cffi", specifier = "==23.1.0" }, { name = "boto3", specifier = "==1.34.89" }, { name = "botocore", specifier = "~=1.34.93" }, - { name = "celery", specifier = "==5.4.0" }, { name = "crispy-bootstrap5", specifier = "==2024.2" }, - { name = "django", specifier = "==5.0.4" }, + { name = "django", specifier = "==5.1.4" }, { name = "django-allauth", extras = ["mfa"], specifier = "==0.62.1" }, - { name = "django-celery-beat", specifier = "==2.6.0" }, { name = "django-crispy-forms", specifier = "==2.1" }, { name = "django-environ", specifier = "==0.11.2" }, { name = "django-model-utils", specifier = "==4.5.1" }, - { name = "django-ratelimit", specifier = "==4.1.0" }, { name = "django-recaptcha", specifier = "==4.0.0" }, { name = "django-redis", specifier = "==5.4.0" }, { name = "django-storages", specifier = "==1.14.3" }, { name = "django-stubs", extras = ["compatible-mypy"], specifier = ">=5.0.4" }, - { name = "flower", specifier = "==2.0.1" }, { name = "gunicorn", specifier = "==22.0.0" }, - { name = "hiredis", specifier = "==2.3.2" }, { name = "markdown", specifier = "==3.6.0" }, { name = "pdf2image", specifier = "==1.17.0" }, { name = "pillow", specifier = "==10.3.0" }, - { name = "psycopg", extras = ["c"], specifier = "==3.1.19" }, { name = "pypdf2", specifier = "==3.0.1" }, - { name = "python-dotenv", specifier = "==1.0.1" }, { name = "python-magic", specifier = "==0.4.27" }, { name = "python-slugify", specifier = "==8.0.4" }, - { name = "redis", specifier = "==5.0.4" }, { name = "sqlparse", specifier = "==0.5.0" }, { name = "stripe", specifier = "==11.1.0" }, { name = "watchfiles", specifier = "==0.21.0" }, @@ -95,6 +80,7 @@ dev = [ { name = "coverage", specifier = "==7.5.1" }, { name = "django-coverage-plugin", specifier = "==3.1.0" }, { name = "factory-boy", specifier = "==3.3.0" }, + { name = "isort", specifier = ">=5.13.2" }, { name = "pdbpp", specifier = "==0.10.3" }, { name = "pytest", specifier = "==8.2.0" }, { name = "pytest-django", specifier = "==4.8.0" }, @@ -103,18 +89,6 @@ dev = [ ] [[package]] -name = "amqp" -version = "5.2.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "vine" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/32/2c/6eb09fbdeb3c060b37bd33f8873832897a83e7a428afe01aad333fc405ec/amqp-5.2.0.tar.gz", hash = "sha256:a1ecff425ad063ad42a486c902807d1482311481c8ad95a72694b2975e75f7fd", size = 128754 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b3/f0/8e5be5d5e0653d9e1d02b1144efa33ff7d2963dfad07049e02c0fa9b2e8d/amqp-5.2.0-py3-none-any.whl", hash = "sha256:827cb12fb0baa892aad844fd95258143bce4027fdac4fccddbc43330fd281637", size = 50917 }, -] - -[[package]] name = "anyio" version = "4.4.0" source = { registry = "https://pypi.org/simple" } @@ -188,15 +162,6 @@ wheels = [ ] [[package]] -name = "billiard" -version = "4.2.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/09/52/f10d74fd56e73b430c37417658158ad8386202b069b70ff97d945c3ab67a/billiard-4.2.0.tar.gz", hash = "sha256:9a3c3184cb275aa17a732f93f65b20c525d3d9f253722d26a82194803ade5a2c", size = 154665 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/50/8d/6e9fdeeab04d803abc5a715175f87e88893934d5590595eacff23ca12b07/billiard-4.2.0-py3-none-any.whl", hash = "sha256:07aa978b308f334ff8282bd4a746e681b3513db5c9a514cbdd810cbbdc19714d", size = 86720 }, -] - -[[package]] name = "boto3" version = "1.34.89" source = { registry = "https://pypi.org/simple" } @@ -225,26 +190,6 @@ wheels = [ ] [[package]] -name = "celery" -version = "5.4.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "billiard" }, - { name = "click" }, - { name = "click-didyoumean" }, - { name = "click-plugins" }, - { name = "click-repl" }, - { name = "kombu" }, - { name = "python-dateutil" }, - { name = "tzdata" }, - { name = "vine" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/8a/9c/cf0bce2cc1c8971bf56629d8f180e4ca35612c7e79e6e432e785261a8be4/celery-5.4.0.tar.gz", hash = "sha256:504a19140e8d3029d5acad88330c541d4c3f64c789d85f94756762d8bca7e706", size = 1575692 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/90/c4/6a4d3772e5407622feb93dd25c86ce3c0fee746fa822a777a627d56b4f2a/celery-5.4.0-py3-none-any.whl", hash = "sha256:369631eb580cf8c51a82721ec538684994f8277637edde2dfc0dacd73ed97f64", size = 425983 }, -] - -[[package]] name = "certifi" version = "2024.8.30" source = { registry = "https://pypi.org/simple" } @@ -338,55 +283,6 @@ wheels = [ ] [[package]] -name = "click" -version = "8.1.7" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "colorama", marker = "platform_system == 'Windows'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de", size = 336121 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/00/2e/d53fa4befbf2cfa713304affc7ca780ce4fc1fd8710527771b58311a3229/click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28", size = 97941 }, -] - -[[package]] -name = "click-didyoumean" -version = "0.3.1" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "click" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/30/ce/217289b77c590ea1e7c24242d9ddd6e249e52c795ff10fac2c50062c48cb/click_didyoumean-0.3.1.tar.gz", hash = "sha256:4f82fdff0dbe64ef8ab2279bd6aa3f6a99c3b28c05aa09cbfc07c9d7fbb5a463", size = 3089 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/1b/5b/974430b5ffdb7a4f1941d13d83c64a0395114503cc357c6b9ae4ce5047ed/click_didyoumean-0.3.1-py3-none-any.whl", hash = "sha256:5c4bb6007cfea5f2fd6583a2fb6701a22a41eb98957e63d0fac41c10e7c3117c", size = 3631 }, -] - -[[package]] -name = "click-plugins" -version = "1.1.1" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "click" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/5f/1d/45434f64ed749540af821fd7e42b8e4d23ac04b1eda7c26613288d6cd8a8/click-plugins-1.1.1.tar.gz", hash = "sha256:46ab999744a9d831159c3411bb0c79346d94a444df9a3a3742e9ed63645f264b", size = 8164 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e9/da/824b92d9942f4e472702488857914bdd50f73021efea15b4cad9aca8ecef/click_plugins-1.1.1-py2.py3-none-any.whl", hash = "sha256:5d262006d3222f5057fd81e1623d4443e41dcda5dc815c06b442aa3c02889fc8", size = 7497 }, -] - -[[package]] -name = "click-repl" -version = "0.3.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "click" }, - { name = "prompt-toolkit" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/cb/a2/57f4ac79838cfae6912f997b4d1a64a858fb0c86d7fcaae6f7b58d267fca/click-repl-0.3.0.tar.gz", hash = "sha256:17849c23dba3d667247dc4defe1757fff98694e90fe37474f3feebb69ced26a9", size = 10449 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/52/40/9d857001228658f0d59e97ebd4c346fe73e138c6de1bce61dc568a57c7f8/click_repl-0.3.0-py3-none-any.whl", hash = "sha256:fb7e06deb8da8de86180a33a9da97ac316751c094c6899382da7feeeeb51b812", size = 10289 }, -] - -[[package]] name = "colorama" version = "0.4.6" source = { registry = "https://pypi.org/simple" } @@ -437,26 +333,17 @@ wheels = [ ] [[package]] -name = "cron-descriptor" -version = "1.4.5" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/02/83/70bd410dc6965e33a5460b7da84cf0c5a7330a68d6d5d4c3dfdb72ca117e/cron_descriptor-1.4.5.tar.gz", hash = "sha256:f51ce4ffc1d1f2816939add8524f206c376a42c87a5fca3091ce26725b3b1bca", size = 30666 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/88/20/2cfe598ead23a715a00beb716477cfddd3e5948cf203c372d02221e5b0c6/cron_descriptor-1.4.5-py3-none-any.whl", hash = "sha256:736b3ae9d1a99bc3dbfc5b55b5e6e7c12031e7ba5de716625772f8b02dcd6013", size = 50370 }, -] - -[[package]] name = "django" -version = "5.0.4" +version = "5.1.4" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "asgiref" }, { name = "sqlparse" }, { name = "tzdata", marker = "sys_platform == 'win32'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/5a/51/30097ef45b0f9bd32908bb3309e9d8c04e2635846e9c73f61b427f6a6c78/Django-5.0.4.tar.gz", hash = "sha256:4bd01a8c830bb77a8a3b0e7d8b25b887e536ad17a81ba2dce5476135c73312bd", size = 10638006 } +sdist = { url = "https://files.pythonhosted.org/packages/d3/e8/536555596dbb79f6e77418aeb40bdc1758c26725aba31919ba449e6d5e6a/Django-5.1.4.tar.gz", hash = "sha256:de450c09e91879fa5a307f696e57c851955c910a438a35e6b4c895e86bedc82a", size = 10716397 } wheels = [ - { url = "https://files.pythonhosted.org/packages/d3/31/32ce7eb77accc1678054fe951228766b47f9ec7d68d96d1caaa2611cbafe/Django-5.0.4-py3-none-any.whl", hash = "sha256:916423499d75d62da7aa038d19aef23d23498d8df229775eb0a6309ee1013775", size = 8183007 }, + { url = "https://files.pythonhosted.org/packages/58/0b/8a4ab2c02982df4ed41e29f28f189459a7eba37899438e6bea7f39db793b/Django-5.1.4-py3-none-any.whl", hash = "sha256:236e023f021f5ce7dee5779de7b286565fdea5f4ab86bae5338e3f7b69896cf0", size = 8276471 }, ] [[package]] @@ -474,20 +361,6 @@ mfa = [ ] [[package]] -name = "django-celery-beat" -version = "2.6.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "celery" }, - { name = "cron-descriptor" }, - { name = "django" }, - { name = "django-timezone-field" }, - { name = "python-crontab" }, - { name = "tzdata" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/1b/ce/308fdad8c073051c0a1e494939d5c304b4efbbeb4bee1115495a60c139e8/django-celery-beat-2.6.0.tar.gz", hash = "sha256:f75b2d129731f1214be8383e18fae6bfeacdb55dffb2116ce849222c0106f9ad", size = 160452 } - -[[package]] name = "django-coverage-plugin" version = "3.1.0" source = { registry = "https://pypi.org/simple" } @@ -533,15 +406,6 @@ wheels = [ ] [[package]] -name = "django-ratelimit" -version = "4.1.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/6f/8f/94038fe739b095aca3e4708ecc8a4e77f1fcfd87bed5d6baff43d4c80bc4/django-ratelimit-4.1.0.tar.gz", hash = "sha256:555943b283045b917ad59f196829530d63be2a39adb72788d985b90c81ba808b", size = 11551 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/fb/78/2c59b30cd8bc8068d02349acb6aeed5c4e05eb01cdf2107ccd76f2e81487/django_ratelimit-4.1.0-py2.py3-none-any.whl", hash = "sha256:d047a31cf94d83ef1465d7543ca66c6fc16695559b5f8d814d1b51df15110b92", size = 11608 }, -] - -[[package]] name = "django-recaptcha" version = "4.0.0" source = { registry = "https://pypi.org/simple" } @@ -613,18 +477,6 @@ wheels = [ ] [[package]] -name = "django-timezone-field" -version = "7.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "django" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/94/b3/992aa517b95f2e6934aa05b8160cf55f91c49c7b91e33076ea9af2f29920/django_timezone_field-7.0.tar.gz", hash = "sha256:aa6f4965838484317b7f08d22c0d91a53d64e7bbbd34264468ae83d4023898a7", size = 13683 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/2a/f9/11769c4414026f1a9ce3e581731d07b084683fc7b4c580703dc71ef81347/django_timezone_field-7.0-py3-none-any.whl", hash = "sha256:3232e7ecde66ba4464abb6f9e6b8cc739b914efb9b29dc2cf2eee451f7cc2acb", size = 13161 }, -] - -[[package]] name = "factory-boy" version = "3.3.0" source = { registry = "https://pypi.org/simple" } @@ -653,7 +505,7 @@ name = "fancycompleter" version = "0.9.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "pyreadline", marker = "platform_system == 'Windows'" }, + { name = "pyreadline", marker = "sys_platform == 'win32'" }, { name = "pyrepl" }, ] sdist = { url = "https://files.pythonhosted.org/packages/a9/95/649d135442d8ecf8af5c7e235550c628056423c96c4bc6787348bdae9248/fancycompleter-0.9.1.tar.gz", hash = "sha256:09e0feb8ae242abdfd7ef2ba55069a46f011814a80fe5476be48f51b00247272", size = 10866 } @@ -662,22 +514,6 @@ wheels = [ ] [[package]] -name = "flower" -version = "2.0.1" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "celery" }, - { name = "humanize" }, - { name = "prometheus-client" }, - { name = "pytz" }, - { name = "tornado" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/09/a1/357f1b5d8946deafdcfdd604f51baae9de10aafa2908d0b7322597155f92/flower-2.0.1.tar.gz", hash = "sha256:5ab717b979530770c16afb48b50d2a98d23c3e9fe39851dcf6bc4d01845a02a0", size = 3220408 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/a6/ff/ee2f67c0ff146ec98b5df1df637b2bc2d17beeb05df9f427a67bd7a7d79c/flower-2.0.1-py2.py3-none-any.whl", hash = "sha256:9db2c621eeefbc844c8dd88be64aef61e84e2deb29b271e02ab2b5b9f01068e2", size = 383553 }, -] - -[[package]] name = "gunicorn" version = "22.0.0" source = { registry = "https://pypi.org/simple" } @@ -690,53 +526,6 @@ wheels = [ ] [[package]] -name = "hiredis" -version = "2.3.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/fe/2d/a5ae61da1157644f7e52e088fa158ac6f5d09775112d14b1c9b9a5156bf1/hiredis-2.3.2.tar.gz", hash = "sha256:733e2456b68f3f126ddaf2cd500a33b25146c3676b97ea843665717bda0c5d43", size = 87598 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/83/94/6e729760c66b3eeeec1ea02e06596d7a36b97fa414dd7e25130a34be5238/hiredis-2.3.2-cp311-cp311-macosx_10_15_universal2.whl", hash = "sha256:adfbf2e9c38b77d0db2fb32c3bdaea638fa76b4e75847283cd707521ad2475ef", size = 82807 }, - { url = "https://files.pythonhosted.org/packages/d9/08/e1de65a655ad7ab3b76d01e718a5f4e3503d8c25bf107731608e49a859df/hiredis-2.3.2-cp311-cp311-macosx_10_15_x86_64.whl", hash = "sha256:80b02d27864ebaf9b153d4b99015342382eeaed651f5591ce6f07e840307c56d", size = 45498 }, - { url = "https://files.pythonhosted.org/packages/6f/89/2bbc2d9400dbb18161e9e6ce5821ff06725a78df2e471875a667f6b61d08/hiredis-2.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bd40d2e2f82a483de0d0a6dfd8c3895a02e55e5c9949610ecbded18188fd0a56", size = 42829 }, - { url = "https://files.pythonhosted.org/packages/4b/d3/b99f6bc21971a7ee889711e62fa9444012999821b06d4e0db300195ef17e/hiredis-2.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dfa904045d7cebfb0f01dad51352551cce1d873d7c3f80c7ded7d42f8cac8f89", size = 167089 }, - { url = "https://files.pythonhosted.org/packages/2e/a1/e149bbe353c202eb578f8f13426fa9e8a9bedb72e6afd1947d830890db3f/hiredis-2.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:28bd184b33e0dd6d65816c16521a4ba1ffbe9ff07d66873c42ea4049a62fed83", size = 177968 }, - { url = "https://files.pythonhosted.org/packages/a2/3d/1b6a97fd60998206a09b7c9426d83f1401cd63e358ba385800d2ffad7174/hiredis-2.3.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f70481213373d44614148f0f2e38e7905be3f021902ae5167289413196de4ba4", size = 167638 }, - { url = "https://files.pythonhosted.org/packages/cd/24/86f9359ec4de465bafc90890b57439eca907882d03602a08eb3abec05a68/hiredis-2.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eb8797b528c1ff81eef06713623562b36db3dafa106b59f83a6468df788ff0d1", size = 167286 }, - { url = "https://files.pythonhosted.org/packages/b3/01/f71c0ca9acfb2ce6eacb8bfa9963a19220fdfce4b7bc0c6af247ffdec6ec/hiredis-2.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:02fc71c8333586871602db4774d3a3e403b4ccf6446dc4603ec12df563127cee", size = 163141 }, - { url = "https://files.pythonhosted.org/packages/0f/81/1a87b64a4c33e18c30b4e41d8a4cf222c2fff74933d27ed293c2465a6439/hiredis-2.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:0da56915bda1e0a49157191b54d3e27689b70960f0685fdd5c415dacdee2fbed", size = 175058 }, - { url = "https://files.pythonhosted.org/packages/49/c0/35cf55026829e06b9c3e9927b7f66f1310afc1f08087796462b02c27eaef/hiredis-2.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:e2674a5a3168349435b08fa0b82998ed2536eb9acccf7087efe26e4cd088a525", size = 170405 }, - { url = "https://files.pythonhosted.org/packages/dd/15/c582c84db3854275d80786cf4e1a01ef11fd70e016a083707a9e24bdd36a/hiredis-2.3.2-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:dc1c3fd49930494a67dcec37d0558d99d84eca8eb3f03b17198424538f2608d7", size = 183469 }, - { url = "https://files.pythonhosted.org/packages/6c/6a/d8e9c48487e6f0e39fa921d88d04fef7e96500e17c5b7eb0c5bcf9406c1f/hiredis-2.3.2-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:14c7b43205e515f538a9defb4e411e0f0576caaeeda76bb9993ed505486f7562", size = 173803 }, - { url = "https://files.pythonhosted.org/packages/77/8d/7a0b1e463073f987a2d269af687877a295dde4daad3842f2731d92564888/hiredis-2.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:7bac7e02915b970c3723a7a7c5df4ba7a11a3426d2a3f181e041aa506a1ff028", size = 173922 }, - { url = "https://files.pythonhosted.org/packages/2f/f9/9a770058242120a66a3a256ce4d0fec10312566272b7096d5f3666f77f17/hiredis-2.3.2-cp311-cp311-win32.whl", hash = "sha256:63a090761ddc3c1f7db5e67aa4e247b4b3bb9890080bdcdadd1b5200b8b89ac4", size = 19598 }, - { url = "https://files.pythonhosted.org/packages/a7/f5/7ed05fba6ab598ef760b5b2ee62762d0cfdef6d0bdffbebb6f9550f67a53/hiredis-2.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:70d226ab0306a5b8d408235cabe51d4bf3554c9e8a72d53ce0b3c5c84cf78881", size = 21199 }, - { url = "https://files.pythonhosted.org/packages/50/69/51db3aaac7c862b3023675cf71c0f41d9abb82edceb7fe31b3872238f861/hiredis-2.3.2-cp312-cp312-macosx_10_15_universal2.whl", hash = "sha256:5c614552c6bd1d0d907f448f75550f6b24fb56cbfce80c094908b7990cad9702", size = 82914 }, - { url = "https://files.pythonhosted.org/packages/0f/47/c0ea174d1b9416f5847f9010d2879ab4493ad104c8dbdec868779cee210a/hiredis-2.3.2-cp312-cp312-macosx_10_15_x86_64.whl", hash = "sha256:9c431431abf55b64347ddc8df68b3ef840269cb0aa5bc2d26ad9506eb4b1b866", size = 45588 }, - { url = "https://files.pythonhosted.org/packages/92/63/5bf5c439c1af0b7480b7f75f6af02eb7cdcd70b882b50597b68178c3f7ef/hiredis-2.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a45857e87e9d2b005e81ddac9d815a33efd26ec67032c366629f023fe64fb415", size = 42847 }, - { url = "https://files.pythonhosted.org/packages/95/a0/e59d94e353bcb745149d3c0265ce972b059a03ceb583d575b49ed2124a32/hiredis-2.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e138d141ec5a6ec800b6d01ddc3e5561ce1c940215e0eb9960876bfde7186aae", size = 169068 }, - { url = "https://files.pythonhosted.org/packages/63/2f/92ce21c16d31ba48a0ab29a7ca8d418adf755fa3396abafe1dc5150526d8/hiredis-2.3.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:387f655444d912a963ab68abf64bf6e178a13c8e4aa945cb27388fd01a02e6f1", size = 179907 }, - { url = "https://files.pythonhosted.org/packages/8d/68/97535298184446c7dfa6bf8c5a7bce0ca5a105a85ffd0b2e4ecaed8cd721/hiredis-2.3.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4852f4bf88f0e2d9bdf91279892f5740ed22ae368335a37a52b92a5c88691140", size = 169407 }, - { url = "https://files.pythonhosted.org/packages/54/8e/379a340be1bc2e39d8060c97ac050bb0f5b0c78d69bcf7384d153dc1030e/hiredis-2.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d711c107e83117129b7f8bd08e9820c43ceec6204fff072a001fd82f6d13db9f", size = 169874 }, - { url = "https://files.pythonhosted.org/packages/17/33/25716dbb79df5f9221e6d1fe9db47178a449c2046acd317ba6683e00570e/hiredis-2.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:92830c16885f29163e1c2da1f3c1edb226df1210ec7e8711aaabba3dd0d5470a", size = 165363 }, - { url = "https://files.pythonhosted.org/packages/d2/50/e4e5ebbfbd844e087d34ddb7404e9bece9ac46f9e96fd6c8534498871033/hiredis-2.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:16b01d9ceae265d4ab9547be0cd628ecaff14b3360357a9d30c029e5ae8b7e7f", size = 176388 }, - { url = "https://files.pythonhosted.org/packages/5c/35/559d858578b39836d4d5a824bacc8fbd3fecdf76000454f352cf38343931/hiredis-2.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:5986fb5f380169270a0293bebebd95466a1c85010b4f1afc2727e4d17c452512", size = 171773 }, - { url = "https://files.pythonhosted.org/packages/4a/6c/8ab99e4fead92498dc9cfe5eb0a6b712b97ab0d93d95809d36b75a38cd37/hiredis-2.3.2-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:49532d7939cc51f8e99efc326090c54acf5437ed88b9c904cc8015b3c4eda9c9", size = 184502 }, - { url = "https://files.pythonhosted.org/packages/1d/bd/ca13dc4341e57a7405246e7857054bb3a4cc9546f9030fa6001c05e62459/hiredis-2.3.2-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:8f34801b251ca43ad70691fb08b606a2e55f06b9c9fb1fc18fd9402b19d70f7b", size = 175147 }, - { url = "https://files.pythonhosted.org/packages/e3/8e/31c66f2e1f5b28ef7872b49e991f7442415495727f10055e547c6ea566ed/hiredis-2.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:7298562a49d95570ab1c7fc4051e72824c6a80e907993a21a41ba204223e7334", size = 175650 }, - { url = "https://files.pythonhosted.org/packages/39/f1/ab594bb6a08dfc9465a2d06315d9ce24c6d189b997d85c373fad60cd3efb/hiredis-2.3.2-cp312-cp312-win32.whl", hash = "sha256:e1d86b75de787481b04d112067a4033e1ecfda2a060e50318a74e4e1c9b2948c", size = 19739 }, - { url = "https://files.pythonhosted.org/packages/d1/37/9f95e75bd0c8da937f57899d2de73e57fd9f87b81375abd4ab58f6d7c23a/hiredis-2.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:6dbfe1887ffa5cf3030451a56a8f965a9da2fa82b7149357752b67a335a05fc6", size = 21269 }, -] - -[[package]] -name = "humanize" -version = "4.10.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/5d/b1/c8f05d5dc8f64030d8cc71e91307c1daadf6ec0d70bcd6eabdfd9b6f153f/humanize-4.10.0.tar.gz", hash = "sha256:06b6eb0293e4b85e8d385397c5868926820db32b9b654b932f57fa41c23c9978", size = 79192 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/8f/49/a29c79bea335e52fb512a43faf84998c184c87fef82c65f568f8c56f2642/humanize-4.10.0-py3-none-any.whl", hash = "sha256:39e7ccb96923e732b5c2e27aeaa3b10a8dfeeba3eb965ba7b74a3eb0e30040a6", size = 126957 }, -] - -[[package]] name = "idna" version = "3.8" source = { registry = "https://pypi.org/simple" } @@ -755,25 +544,21 @@ wheels = [ ] [[package]] -name = "jmespath" -version = "1.0.1" +name = "isort" +version = "5.13.2" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/00/2a/e867e8531cf3e36b41201936b7fa7ba7b5702dbef42922193f05c8976cd6/jmespath-1.0.1.tar.gz", hash = "sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe", size = 25843 } +sdist = { url = "https://files.pythonhosted.org/packages/87/f9/c1eb8635a24e87ade2efce21e3ce8cd6b8630bb685ddc9cdaca1349b2eb5/isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109", size = 175303 } wheels = [ - { url = "https://files.pythonhosted.org/packages/31/b4/b9b800c45527aadd64d5b442f9b932b00648617eb5d63d2c7a6587b7cafc/jmespath-1.0.1-py3-none-any.whl", hash = "sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980", size = 20256 }, + { url = "https://files.pythonhosted.org/packages/d1/b3/8def84f539e7d2289a02f0524b944b15d7c75dab7628bedf1c4f0992029c/isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6", size = 92310 }, ] [[package]] -name = "kombu" -version = "5.4.1" +name = "jmespath" +version = "1.0.1" source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "amqp" }, - { name = "vine" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/16/2c/079a5d59a167543205fbf54d663bbdc171e2a29f4d45fa6a8bc315e57192/kombu-5.4.1.tar.gz", hash = "sha256:1c05178826dab811f8cab5b0a154d42a7a33d8bcdde9fa3d7b4582e43c3c03db", size = 442786 } +sdist = { url = "https://files.pythonhosted.org/packages/00/2a/e867e8531cf3e36b41201936b7fa7ba7b5702dbef42922193f05c8976cd6/jmespath-1.0.1.tar.gz", hash = "sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe", size = 25843 } wheels = [ - { url = "https://files.pythonhosted.org/packages/c1/78/c556bf2954bd36f166959ac33d23cde4a8967e61cdb74678585a66edbae0/kombu-5.4.1-py3-none-any.whl", hash = "sha256:621d365f234e4c089596f3a2510f1ade07026efc28caca426161d8f458786cab", size = 201338 }, + { url = "https://files.pythonhosted.org/packages/31/b4/b9b800c45527aadd64d5b442f9b932b00648617eb5d63d2c7a6587b7cafc/jmespath-1.0.1-py3-none-any.whl", hash = "sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980", size = 20256 }, ] [[package]] @@ -920,51 +705,6 @@ wheels = [ ] [[package]] -name = "prometheus-client" -version = "0.20.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/3d/39/3be07741a33356127c4fe633768ee450422c1231c6d34b951fee1458308d/prometheus_client-0.20.0.tar.gz", hash = "sha256:287629d00b147a32dcb2be0b9df905da599b2d82f80377083ec8463309a4bb89", size = 78278 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/c7/98/745b810d822103adca2df8decd4c0bbe839ba7ad3511af3f0d09692fc0f0/prometheus_client-0.20.0-py3-none-any.whl", hash = "sha256:cde524a85bce83ca359cc837f28b8c0db5cac7aa653a588fd7e84ba061c329e7", size = 54474 }, -] - -[[package]] -name = "prompt-toolkit" -version = "3.0.47" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "wcwidth" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/47/6d/0279b119dafc74c1220420028d490c4399b790fc1256998666e3a341879f/prompt_toolkit-3.0.47.tar.gz", hash = "sha256:1e1b29cb58080b1e69f207c893a1a7bf16d127a5c30c9d17a25a5d77792e5360", size = 425859 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e8/23/22750c4b768f09386d1c3cc4337953e8936f48a888fa6dddfb669b2c9088/prompt_toolkit-3.0.47-py3-none-any.whl", hash = "sha256:0d7bfa67001d5e39d02c224b663abc33687405033a8c422d0d675a5a13361d10", size = 386411 }, -] - -[[package]] -name = "psycopg" -version = "3.1.19" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "typing-extensions" }, - { name = "tzdata", marker = "sys_platform == 'win32'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/e5/b8/dc85a3b5d3576527c288197de5db85edd141d6ce27fcf73e9f77e871824a/psycopg-3.1.19.tar.gz", hash = "sha256:92d7b78ad82426cdcf1a0440678209faa890c6e1721361c2f8901f0dccd62961", size = 147457 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/f2/cf/172701ea48987548c681e011681dda1d2605131f723e89225477fe7802e9/psycopg-3.1.19-py3-none-any.whl", hash = "sha256:dca5e5521c859f6606686432ae1c94e8766d29cc91f2ee595378c510cc5b0731", size = 179386 }, -] - -[package.optional-dependencies] -c = [ - { name = "psycopg-c", marker = "implementation_name != 'pypy'" }, -] - -[[package]] -name = "psycopg-c" -version = "3.1.19" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/64/7e/1b75babba770e9869d27e2aed23ee5d903c9aa748d8dd1ef783c9cca1de5/psycopg_c-3.1.19.tar.gz", hash = "sha256:8e90f53c430e7d661cb3a9298e2761847212ead1b24c5fb058fc9d0fd9616017", size = 562146 } - -[[package]] name = "pycparser" version = "2.22" source = { registry = "https://pypi.org/simple" } @@ -1054,18 +794,6 @@ wheels = [ ] [[package]] -name = "python-crontab" -version = "3.2.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "python-dateutil" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/e2/f0/25775565c133d4e29eeb607bf9ddba0075f3af36041a1844dd207881047f/python_crontab-3.2.0.tar.gz", hash = "sha256:40067d1dd39ade3460b2ad8557c7651514cd3851deffff61c5c60e1227c5c36b", size = 57001 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/3b/91/832fb3b3a1f62bd2ab4924f6be0c7736c9bc4f84d3b153b74efcf6d4e4a1/python_crontab-3.2.0-py3-none-any.whl", hash = "sha256:82cb9b6a312d41ff66fd3caf3eed7115c28c195bfb50711bc2b4b9592feb9fe5", size = 27351 }, -] - -[[package]] name = "python-dateutil" version = "2.9.0.post0" source = { registry = "https://pypi.org/simple" } @@ -1078,15 +806,6 @@ wheels = [ ] [[package]] -name = "python-dotenv" -version = "1.0.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/bc/57/e84d88dfe0aec03b7a2d4327012c1627ab5f03652216c63d49846d7a6c58/python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca", size = 39115 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/6a/3e/b68c118422ec867fa7ab88444e1274aa40681c606d59ac27de5a5588f082/python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a", size = 19863 }, -] - -[[package]] name = "python-magic" version = "0.4.27" source = { registry = "https://pypi.org/simple" } @@ -1108,20 +827,11 @@ wheels = [ ] [[package]] -name = "pytz" -version = "2024.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/3a/31/3c70bf7603cc2dca0f19bdc53b4537a797747a58875b552c8c413d963a3f/pytz-2024.2.tar.gz", hash = "sha256:2aa355083c50a0f93fa581709deac0c9ad65cca8a9e9beac660adcbd493c798a", size = 319692 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/11/c3/005fcca25ce078d2cc29fd559379817424e94885510568bc1bc53d7d5846/pytz-2024.2-py2.py3-none-any.whl", hash = "sha256:31c7c1817eb7fae7ca4b8c7ee50c72f93aa2dd863de768e1ef4245d426aa0725", size = 508002 }, -] - -[[package]] name = "qrcode" version = "7.4.2" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "platform_system == 'Windows'" }, + { name = "colorama", marker = "sys_platform == 'win32'" }, { name = "pypng" }, { name = "typing-extensions" }, ] @@ -1253,24 +963,6 @@ wheels = [ ] [[package]] -name = "tornado" -version = "6.4.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/ee/66/398ac7167f1c7835406888a386f6d0d26ee5dbf197d8a571300be57662d3/tornado-6.4.1.tar.gz", hash = "sha256:92d3ab53183d8c50f8204a51e6f91d18a15d5ef261e84d452800d4ff6fc504e9", size = 500623 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/00/d9/c33be3c1a7564f7d42d87a8d186371a75fd142097076767a5c27da941fef/tornado-6.4.1-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:163b0aafc8e23d8cdc3c9dfb24c5368af84a81e3364745ccb4427669bf84aec8", size = 435924 }, - { url = "https://files.pythonhosted.org/packages/2e/0f/721e113a2fac2f1d7d124b3279a1da4c77622e104084f56119875019ffab/tornado-6.4.1-cp38-abi3-macosx_10_9_x86_64.whl", hash = "sha256:6d5ce3437e18a2b66fbadb183c1d3364fb03f2be71299e7d10dbeeb69f4b2a14", size = 433883 }, - { url = "https://files.pythonhosted.org/packages/13/cf/786b8f1e6fe1c7c675e79657448178ad65e41c1c9765ef82e7f6f765c4c5/tornado-6.4.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e2e20b9113cd7293f164dc46fffb13535266e713cdb87bd2d15ddb336e96cfc4", size = 437224 }, - { url = "https://files.pythonhosted.org/packages/e4/8e/a6ce4b8d5935558828b0f30f3afcb2d980566718837b3365d98e34f6067e/tornado-6.4.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8ae50a504a740365267b2a8d1a90c9fbc86b780a39170feca9bcc1787ff80842", size = 436597 }, - { url = "https://files.pythonhosted.org/packages/22/d4/54f9d12668b58336bd30defe0307e6c61589a3e687b05c366f804b7faaf0/tornado-6.4.1-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:613bf4ddf5c7a95509218b149b555621497a6cc0d46ac341b30bd9ec19eac7f3", size = 436797 }, - { url = "https://files.pythonhosted.org/packages/cf/3f/2c792e7afa7dd8b24fad7a2ed3c2f24a5ec5110c7b43a64cb6095cc106b8/tornado-6.4.1-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:25486eb223babe3eed4b8aecbac33b37e3dd6d776bc730ca14e1bf93888b979f", size = 437516 }, - { url = "https://files.pythonhosted.org/packages/71/63/c8fc62745e669ac9009044b889fc531b6f88ac0f5f183cac79eaa950bb23/tornado-6.4.1-cp38-abi3-musllinux_1_2_i686.whl", hash = "sha256:454db8a7ecfcf2ff6042dde58404164d969b6f5d58b926da15e6b23817950fc4", size = 436958 }, - { url = "https://files.pythonhosted.org/packages/94/d4/f8ac1f5bd22c15fad3b527e025ce219bd526acdbd903f52053df2baecc8b/tornado-6.4.1-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a02a08cc7a9314b006f653ce40483b9b3c12cda222d6a46d4ac63bb6c9057698", size = 436882 }, - { url = "https://files.pythonhosted.org/packages/4b/3e/a8124c21cc0bbf144d7903d2a0cadab15cadaf683fa39a0f92bc567f0d4d/tornado-6.4.1-cp38-abi3-win32.whl", hash = "sha256:d9a566c40b89757c9aa8e6f032bcdb8ca8795d7c1a9762910c722b1635c9de4d", size = 438092 }, - { url = "https://files.pythonhosted.org/packages/d9/2f/3f2f05e84a7aff787a96d5fb06821323feb370fe0baed4db6ea7b1088f32/tornado-6.4.1-cp38-abi3-win_amd64.whl", hash = "sha256:b24b8982ed444378d7f21d563f4180a2de31ced9d8d84443907a0a64da2072e7", size = 438532 }, -] - -[[package]] name = "types-pyyaml" version = "6.0.12.20240808" source = { registry = "https://pypi.org/simple" } @@ -1307,15 +999,6 @@ wheels = [ ] [[package]] -name = "vine" -version = "5.1.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/bd/e4/d07b5f29d283596b9727dd5275ccbceb63c44a1a82aa9e4bfd20426762ac/vine-5.1.0.tar.gz", hash = "sha256:8b62e981d35c41049211cf62a0a1242d8c1ee9bd15bb196ce38aefd6799e61e0", size = 48980 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/03/ff/7c0c86c43b3cbb927e0ccc0255cb4057ceba4799cd44ae95174ce8e8b5b2/vine-5.1.0-py3-none-any.whl", hash = "sha256:40fdf3c48b2cfe1c38a49e9ae2da6fda88e4794c810050a728bd7413811fb1dc", size = 9636 }, -] - -[[package]] name = "watchdog" version = "5.0.2" source = { registry = "https://pypi.org/simple" } @@ -1380,15 +1063,6 @@ wheels = [ ] [[package]] -name = "wcwidth" -version = "0.2.13" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/6c/63/53559446a878410fc5a5974feb13d31d78d752eb18aeba59c7fef1af7598/wcwidth-0.2.13.tar.gz", hash = "sha256:72ea0c06399eb286d978fdedb6923a9eb47e1c486ce63e9b4e64fc18303972b5", size = 101301 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/fd/84/fd2ba7aafacbad3c4201d395674fc6348826569da3c0937e75505ead3528/wcwidth-0.2.13-py2.py3-none-any.whl", hash = "sha256:3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859", size = 34166 }, -] - -[[package]] name = "werkzeug" version = "3.0.2" source = { registry = "https://pypi.org/simple" } diff --git a/wait-for-it.sh b/wait-for-it.sh deleted file mode 100755 index d990e0d..0000000 --- a/wait-for-it.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env bash -# Use this script to test if a given TCP host/port are available - -WAITFORIT_cmdname=${0##*/} - -echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } - -usage() -{ - cat << USAGE >&2 -Usage: - $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args] - -h HOST | --host=HOST Host or IP under test - -p PORT | --port=PORT TCP port under test - Alternatively, you specify the host and port as host:port - -s | --strict Only execute subcommand if the test succeeds - -q | --quiet Don't output any status messages - -t TIMEOUT | --timeout=TIMEOUT - Timeout in seconds, zero for no timeout - -- COMMAND ARGS Execute command with args after the test finishes -USAGE - exit 1 -} - -wait_for() -{ - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - else - echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" - fi - WAITFORIT_start_ts=$(date +%s) - while : - do - if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then - nc -z $WAITFORIT_HOST $WAITFORIT_PORT - WAITFORIT_result=$? - else - (echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 - WAITFORIT_result=$? - fi - if [[ $WAITFORIT_result -eq 0 ]]; then - WAITFORIT_end_ts=$(date +%s) - echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" - break - fi - sleep 1 - done - return $WAITFORIT_result -} - -wait_for_wrapper() -{ - # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 - if [[ $WAITFORIT_QUIET -eq 1 ]]; then - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - else - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - fi - WAITFORIT_PID=$! - trap "kill -INT -$WAITFORIT_PID" INT - wait $WAITFORIT_PID - WAITFORIT_RESULT=$? - if [[ $WAITFORIT_RESULT -ne 0 ]]; then - echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - fi - return $WAITFORIT_RESULT -} - -# process arguments -while [[ $# -gt 0 ]] -do - case "$1" in - *:* ) - WAITFORIT_hostport=(${1//:/ }) - WAITFORIT_HOST=${WAITFORIT_hostport[0]} - WAITFORIT_PORT=${WAITFORIT_hostport[1]} - shift 1 - ;; - --child) - WAITFORIT_CHILD=1 - shift 1 - ;; - -q | --quiet) - WAITFORIT_QUIET=1 - shift 1 - ;; - -s | --strict) - WAITFORIT_STRICT=1 - shift 1 - ;; - -h) - WAITFORIT_HOST="$2" - if [[ $WAITFORIT_HOST == "" ]]; then break; fi - shift 2 - ;; - --host=*) - WAITFORIT_HOST="${1#*=}" - shift 1 - ;; - -p) - WAITFORIT_PORT="$2" - if [[ $WAITFORIT_PORT == "" ]]; then break; fi - shift 2 - ;; - --port=*) - WAITFORIT_PORT="${1#*=}" - shift 1 - ;; - -t) - WAITFORIT_TIMEOUT="$2" - if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi - shift 2 - ;; - --timeout=*) - WAITFORIT_TIMEOUT="${1#*=}" - shift 1 - ;; - --) - shift - WAITFORIT_CLI=("$@") - break - ;; - --help) - usage - ;; - *) - echoerr "Unknown argument: $1" - usage - ;; - esac -done - -if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then - echoerr "Error: you need to provide a host and port to test." - usage -fi - -WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15} -WAITFORIT_STRICT=${WAITFORIT_STRICT:-0} -WAITFORIT_CHILD=${WAITFORIT_CHILD:-0} -WAITFORIT_QUIET=${WAITFORIT_QUIET:-0} - -# Check to see if timeout is from busybox? -WAITFORIT_TIMEOUT_PATH=$(type -p timeout) -WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) - -WAITFORIT_BUSYTIMEFLAG="" -if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then - WAITFORIT_ISBUSY=1 - # Check if busybox timeout uses -t flag - # (recent Alpine versions don't support -t anymore) - if timeout &>/dev/stdout | grep -q -e '-t '; then - WAITFORIT_BUSYTIMEFLAG="-t" - fi -else - WAITFORIT_ISBUSY=0 -fi - -if [[ $WAITFORIT_CHILD -gt 0 ]]; then - wait_for - WAITFORIT_RESULT=$? - exit $WAITFORIT_RESULT -else - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - wait_for_wrapper - WAITFORIT_RESULT=$? - else - wait_for - WAITFORIT_RESULT=$? - fi -fi - -if [[ $WAITFORIT_CLI != "" ]]; then - if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then - echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess" - exit $WAITFORIT_RESULT - fi - exec "${WAITFORIT_CLI[@]}" -else - exit $WAITFORIT_RESULT -fi |