Coder Social home page Coder Social logo

mabdullahadeel / cookiecutter-django-mysql Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cookiecutter/cookiecutter-django

40.0 40.0 14.0 7 MB

Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Home Page: https://cookiecutter-django-mysql.readthedocs.io/

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.58% Python 67.82% Shell 11.57% CSS 0.12% JavaScript 2.69% HTML 11.13% Batchfile 0.54% Dockerfile 4.99% SCSS 0.34% Procfile 0.22%
boilerplate celery cookiecutter cookiecutter-django cookiecutter-django-docker cookiecutter-django-mysql django django-cookiecutter django-rest-framework docker heroku mysql postgresql project-template python

cookiecutter-django-mysql's Introduction

Hi ๐Ÿ‘‹, Abdullah Adeel (AB) here...

I like learning new things, sharing and building things collaboratively..


๐Ÿค Let's meet

abdadeel abdadeel abdadeel abdadeel abdadeel abdadeel

๐Ÿค– I work with

abdadeel abdadeel abdadeel
abdadeel abdadeel abdadeel abdadeel abdadeel abdadeel
abdadeel abdadeel-postgres abdadeel-redis abdadeel
abdadeel abdadeel abdadeel abdadeel abdadeel

๐Ÿ’Ÿ Interested in

abdadeel abdadeel-solid.js abdadeel-rust

cookiecutter-django-mysql's People

Contributors

actions-user avatar afrowave avatar andrew-chen-wang avatar arnav13081994 avatar ashwoods avatar audreyfeldroy avatar bogdal avatar browniebroke avatar burhan avatar crdoconnor avatar danihodovic avatar demestav avatar dependabot[bot] avatar foarsitter avatar github-actions[bot] avatar hackebrot avatar jayfk avatar kappataumu avatar luzfcb avatar mabdullahadeel avatar noisy avatar pydanny avatar pyup-bot avatar sfdye avatar shireenrao avatar tanoabeleyra avatar theskumar avatar trungdong avatar webyneter avatar yunti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cookiecutter-django-mysql's Issues

Add MySQL support to django-cookiecutter.

Description

What are you proposing? How should it be implemented?
Add MySQL support to django-cookiecutter.

Rationale

Why should this feature be implemented?

MySQL is also among the databases that are highly supported by Django and widely used.

pytest not running with mysql database

What happened?

When running a test with mysql as a database engine, the error occurs that the current database user does not have access to the test database which is created for testing purposes.

What should've happened instead?

The test should run smoothly and if some of the test fails, show error related to that test by pytest. But currently, even the default tests right after the project generation throwing errors.

Additional details

  • Host system configuration:
    • Version of cookiecutter CLI (get it with cookiecutter --version):
      Cookiecutter 1.7.3 from c:\users\hp\appdata\local\programs\python\python39\lib\site-packages (Python 3.9)

    • OS name and version:

      On Linux, run

      lsb_release -a 2> /dev/null || cat /etc/redhat-release 2> /dev/null || cat /etc/*-release 2> /dev/null || cat /etc/issue 2> /dev/null

      On MacOs, run

      sw_vers

      On Windows, via CMD, run

      systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
      
      # Insert here the OS name and version
      OS Name:                   Microsoft Windows 10 Pro
      OS Version:                10.0.19043 N/A Build 19043
    • Python version, run python3 -V: Python 3.9.9

    • Docker version (if using Docker), run docker --version: Docker version 20.10.12, build e91ed57

    • docker-compose version (if using Docker), run docker-compose --version: Docker Compose version v2.2.3

    • ...

  • Options selected and/or replay file:
    On Linux and MacOS: cat ${HOME}/.cookiecutter_replay/cookiecutter-django.json
    (Please, take care to remove sensitive information)
    # Insert here the replay file content
    {
    "cookiecutter": {
    "project_name": "test_master",
    "project_slug": "test_master",
    "description": "Behold My Awesome Project!",
    "author_name": "Daniel Roy Greenfeld",
    "domain_name": "example.com",
    "email": "[email protected]",
    "version": "0.1.0",
    "open_source_license": "MIT",
    "timezone": "UTC",
    "windows": "y",
    "use_pycharm": "n",
    "use_docker": "y",
    "database_engine": "mysql",
    "database_version": "[email protected]",
    "__processed_database_engine": "{{ cookiecutter.database_version.lower()|split('@')[0] }}",
    "__processed_database_version": "{{ cookiecutter.database_version.lower()|split('@')[1] }}",
    "js_task_runner": "None",
    "cloud_provider": "AWS",
    "mail_service": "Amazon SES",
    "use_async": "n",
    "use_drf": "y",
    "custom_bootstrap_compilation": "n",
    "use_compressor": "n",
    "use_celery": "n",
    "use_mailhog": "n",
    "use_sentry": "n",
    "use_whitenoise": "n",
    "use_heroku": "n",
    "ci_tool": "Github",
    "keep_local_envs_in_vcs": "y",
    "debug": "y",
    "_template": "https://github.com/mabdullahadeel/cookiecutter-django-mysql.git"
    }

}
```

Logs:
self = <_mysql.connection closed at 0x564d766406e0>
query = b'CREATE DATABASE `test_my_awesome_project` '
def query(self, query):
    # Since _mysql releases GIL while querying, we need immutable buffer.
    if isinstance(query, bytearray):
        query = bytes(query)
  _mysql.connection.query(self, query)
 MySQLdb._exceptions.OperationalError: (1044, "Access denied for user 'hTXMUAgmwadoPNtqiaAXbrqPWtbnuTxY'@'%' to database 'test_my_awesome_project'")

/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py:254: OperationalError

mysql 8.0 support

Description

What are you proposing? How should it be implemented?

Add support for MySQL 8.0

Rationale

Why should this feature be implemented?

jinja2.exceptions.TemplateSyntaxError

What happened?

On running cookiecutter for the template, getting jinja2.exceptions.TemplateSyntaxError: expected token 'end of print statement', got '['

  • Host system configuration:
    • Version of cookiecutter CLI (get it with cookiecutter --version): Cookiecutter 2.1.1

    • OS name and version: Ubuntu 22.04 LTS

      On Linux, run

      cookiecutter https://github.com/mabdullahadeel/cookiecutter-django-mysql.git 
    • Python version, run python3 -V: Python 3.10.4

Logs:
~/Projects/cookiecutter > cookiecutter https://github.com/mabdullahadeel/cookiecutter-django-mysql.git                                                                               py venv-cookiecutter 14:09:23
You've downloaded /home/asus/.cookiecutters/cookiecutter-django-mysql before. Is it okay to delete and re-download it? [yes]: 
project_name [My Awesome Project]: 
project_slug [my_awesome_project]: 
description [Behold My Awesome Project!]: 
author_name [Daniel Roy Greenfeld]: 
domain_name [example.com]: 
email [[email protected]]: 
version [0.1.0]: 
Select open_source_license:
1 - MIT
2 - BSD
3 - GPLv3
4 - Apache Software License 2.0
5 - Not open source
Choose from 1, 2, 3, 4, 5 [1]: 
timezone [UTC]: 
windows [n]: 
use_pycharm [n]: 
use_docker [n]: 
Select database_engine:
1 - postgresql
2 - mysql
Choose from 1, 2 [1]: 
Select database_version:
1 - postgresql@14
2 - postgresql@13
3 - postgresql@12
4 - postgresql@11
5 - postgresql@10
6 - [email protected]
7 - [email protected]
8 - [email protected]
Choose from 1, 2, 3, 4, 5, 6, 7, 8 [1]: 
Traceback (most recent call last):
  File "/home/asus/venvs/venv-cookiecutter/bin/cookiecutter", line 8, in 
    sys.exit(main())
  File "/home/asus/venvs/venv-cookiecutter/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/asus/venvs/venv-cookiecutter/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/asus/venvs/venv-cookiecutter/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/asus/venvs/venv-cookiecutter/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/asus/venvs/venv-cookiecutter/lib/python3.10/site-packages/cookiecutter/cli.py", line 194, in main
    cookiecutter(
  File "/home/asus/venvs/venv-cookiecutter/lib/python3.10/site-packages/cookiecutter/main.py", line 102, in cookiecutter
    context['cookiecutter'] = prompt_for_config(context, no_input)
  File "/home/asus/venvs/venv-cookiecutter/lib/python3.10/site-packages/cookiecutter/prompt.py", line 195, in prompt_for_config
    cookiecutter_dict[key] = render_variable(env, raw, cookiecutter_dict)
  File "/home/asus/venvs/venv-cookiecutter/lib/python3.10/site-packages/cookiecutter/prompt.py", line 160, in render_variable
    template = env.from_string(raw)
  File "/home/asus/venvs/venv-cookiecutter/lib/python3.10/site-packages/jinja2/environment.py", line 1105, in from_string
    return cls.from_code(self, self.compile(source), gs, None)
  File "/home/asus/venvs/venv-cookiecutter/lib/python3.10/site-packages/jinja2/environment.py", line 768, in compile
    self.handle_exception(source=source_hint)
  File "/home/asus/venvs/venv-cookiecutter/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "", line 1, in template
jinja2.exceptions.TemplateSyntaxError: expected token 'end of print statement', got '['

Improve ReadMe with changes reflecting MySQL support

Description

Current Readme is identical to the standard PostgreSQL-based https://github.com/cookiecutter/cookiecutter-django repo.

Rationale

This is both confusing (for example, it still has the link to this project in it) and not helpful.

It would be helpful for someone like me that only sets up a new environment once in a while to have instructions on how to setup my MySQL environment as it differs from PostgreSQL from the docs.

Error when executing Sphinx command

What happened?

Execute make -C docs livehtml in the project root path, and an error is reported

What should've happened instead?

Additional details

image

How to Support Mysql8.0?

Description
Currently only supports Mysql5.7, expect to support 8.0.Because when using Mysql8 locally, an error will be reported

Rationale
When using Mysql8.0 locally, executing python manage.py migrate will report an error, indicating that the version is inconsistent, specifically the file root_path/contrib/sites/migrations/0003_set_site_domain_and_name.py
The specific method is _update_or_create_site_with_sequence
The specific code is

    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()
            print(123123, current_id)
            if current_id <= max_id:
                cursor.execute(
                    "alter sequence django_site_id_seq restart with %s",
                    [max_id + 1],
                )

If you comment out if created this code will not report an error

update github actions

Description

What are you proposing? How should it be implemented?

Update GitHub actions to include the tests with MySQL database in docker containers.

Rationale

Why should this feature be implemented?

Add `actions` to test bare metal with MYSQL database.

Description

What are you proposing? How should it be implemented?

Update github actions to run bare metal tests with MySQL database

Rationale

Why should this feature be implemented?

Currently, no tests are being run when no docker container is being used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.